Android Studio Signed APKでThis fragment should provide a default constructor

Android

Android Studioで開発中は普通にRunできていたのに、いざ、Google Playへ公開!と思って、Generate Signed APKとすると、次のエラーが出て、証明書でサインされたApkファイルが作れません。

 Error:(16, 12) Error: This fragment should provide a default
 constructor (a public constructor with no arguments)   
 (hogehoge.dialog.DaySelectDialogFragment) [ValidFragment]
 public class DaySelectDialogFragment extends DialogFragment {

うげーっってなりますよね。
ちなみに、ダメ!って言われた、DaySelectDialogFragmentのコードはこちら。

 public class DaySelectDialogFragment extends DialogFragment {
 
    private ArrayList<Integer> mSelectedItems;
    private SettingAlarmHelper alarmHelper;
    private Context context;
    private TextView on_sunday;
    private TextView on_tuesday;
    private TextView on_monday;
    private TextView on_wednesday;
    private TextView on_thursday;
    private TextView on_friday;
    private TextView on_saturday;
    private TextView no_days_select;
    private String type;
    private TextView off_sunday;
    private TextView off_monday;
    private TextView off_tuesday;
    private TextView off_wednesday;
    private TextView off_thursday;
    private TextView off_friday;
    private TextView no_days_select_off;
    private TextView off_saturday;
 
    public DaySelectDialogFragment() {};
 
    public DaySelectDialogFragment(String _type, ArrayList<Integer> _items,
            SettingAlarmHelper _alarmHelper, Context _context,
            TextView _on_sunday, TextView _on_monday, TextView _on_tuesday,
            TextView _on_wednesday, TextView _on_thursday, TextView _on_friday,
            TextView _on_saturday, TextView _no_days_select,
            TextView _off_sunday, TextView _off_monday, TextView _off_tuesday,
            TextView _off_wednesday, TextView _off_thursday, TextView _off_friday,
            TextView _off_saturday, TextView _no_days_select_off) {
 
        type = _type;
        mSelectedItems = _items;
        alarmHelper = _alarmHelper;
        context = _context;
        on_sunday = _on_sunday;
        on_monday = _on_monday;
        on_tuesday = _on_tuesday;
        on_wednesday = _on_wednesday;
        on_thursday = _on_thursday;
        on_friday = _on_friday;
        on_saturday = _on_saturday;
        no_days_select = _no_days_select;
 
        off_sunday = _off_sunday;
        off_monday = _off_monday;
        off_tuesday = _off_tuesday;
        off_wednesday = _off_wednesday;
        off_thursday = _off_thursday;
        off_friday = _off_friday;
        off_saturday = _off_saturday;
        no_days_select_off = _no_days_select_off;
    }
 
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
 …以下略

下記に情報がありました。

http://stackoverflow.com/questions/29762949/error-this-fragment-should-provide-a-default-constructor-a-public-constructor

空のコンストラクタ作って、セッターで値をセットしよう!
だそうです。
しかし、時間がなかったので、とりあえずbuild.gradleに下記のように書けば、証明書でサインしたアプリが作れました。

 android{
    
    compileSdkVersion 17
    buildToolsVersion "21.1.0"
    dexOptions {
        jumboMode true
    }
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }
 }

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です