简体   繁体   中英

App works well in Debug mode but raises compile error in release mode

My App works well in Debug mode however when i switch to Release mode a compile error appears as follows: Error: This class should provide a default constructor (a public constructor with no arguments) that class is a

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;


public class CFileArrayAdapter extends ArrayAdapter<COption> {

private Context c;
private int id;
private List<COption> items;

public CFileArrayAdapter(Context context, int textViewResourceId,
                         List<COption> objects) {
    super(context, textViewResourceId, objects);
    c = context;
    id = textViewResourceId;
    items = objects;
}
public COption getItem(int i)
{
    return items.get(i);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    if (v == null) {
        LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(id, null);
    }
    final COption o = items.get(position);
    if (o != null) {
        TextView t1 = (TextView) v.findViewById(R.id.TextView01);
        TextView t2 = (TextView) v.findViewById(R.id.TextView02);

        if(t1!=null)
            t1.setText(o.getName());
        if(t2!=null)
            t2.setText(o.getData());

    }
    return v;
}

}

Can anybody help me to solve this problem?

Finally i managed to find what's wrong with my app. I mistakenly have put all my activities including FileArrayAdapter in manifest and that caused strange compile errors in Release mode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM