I have inherited this Android app. When I attempt to build a signed APK, I get an error that says Error:(31) Error: Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead [ValidFragment]
It points to this bit of code:
public class BasicInfoFragment extends BasePassportFragment implements LocationEditText.LocationEditTextListener {
private User user;
private Templates templates;
public BasicInfoFragment() {
super(false);
}
public BasicInfoFragment(User user) {
super(false);
this.user = user;
}
public BasicInfoFragment(User user, Templates templates) {
super(false);
this.user = user;
this.templates = templates;
}
...
}
The error points to the 2nd and 3rd methods, public BasicInfoFragment(User user)
and public BasicInfoFragment(User user, Templates templates)
so I am confused why public BasicInfoFragment()
is okay but the other two are not?