Rec Rec - 7 months ago 30
Android Question

error: this class should provide a default constructor, when creating apk

I'm experiencing this error when building the apk: this class should provide a default constructor (a public constructor with no arguments)

I have searched for this error and a solution is to change the class name, I tried but the error occurs with others classes and after change the name of some classes comeback to the first one, I am in a bucle.

The first class I have the error is this

public class CustomAdapter extends BaseAdapter {

// Declare Variables
Context context;
LayoutInflater inflater;
ImageLoader imageLoader;
private List<Juegos> juegoslist = null;
private ArrayList<Juegos> arraylist;

public CustomAdapter(Context context,
List<Juegos> juegoslist) {

this.context = context;
this.juegoslist = juegoslist;
inflater = LayoutInflater.from(context);
this.arraylist = new ArrayList<Juegos>();
imageLoader = new ImageLoader(context);


I can run the app in a device without problems but I can't create the apk. Someone can help me with this issue?

Thanks and regards,


When you override the constructor, the class understand that it doesn't exist anymore, because you are only defining the modified one. To resolve it just place an empty constructor in the class:

public CustomAdapter(){}