错误:此类应提供默认构造函数(不带参数的公共构造函数)(com.tasbih.counter.tasbihcounter.RegistrationAdapterr)[Instantiatable]
当我尝试构建签名的apk时会发生此错误,但在调试模式下,该应用程序正常工作。请帮忙。
package com.tasbih.counter.tasbihcounter;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
public class RegistrationAdapterr {
SQLiteDatabase database_ob;
RegistrationOpenHelperr openHelper_ob;
Context context;
public RegistrationAdapterr(Context c) {
context = c;
}
public RegistrationAdapterr opnToRead() {
openHelper_ob = new RegistrationOpenHelperr(context,
openHelper_ob.DATABASE_NAME, null, openHelper_ob.VERSION);
database_ob = openHelper_ob.getReadableDatabase();
return this;
}
public RegistrationAdapterr opnToWrite() {
openHelper_ob = new RegistrationOpenHelperr(context,
openHelper_ob.DATABASE_NAME, null, openHelper_ob.VERSION);
database_ob = openHelper_ob.getWritableDatabase();
return this;
}
public void Close() {
database_ob.close();
}
public long insertDetails(String fname, String lname, Integer count) {
ContentValues contentValues = new ContentValues();
contentValues.put(openHelper_ob.FNAME, fname);
contentValues.put(openHelper_ob.LNAME, lname);
contentValues.put(openHelper_ob.COUNT, count);
opnToWrite();
long val = database_ob.insert(openHelper_ob.TABLE_NAME, null,
contentValues);
Close();
return val;
}
public Cursor queryName() {
String[] cols = {openHelper_ob.KEY_ID, openHelper_ob.FNAME,
openHelper_ob.LNAME, openHelper_ob.COUNT};
opnToWrite();
Cursor c = database_ob.query(openHelper_ob.TABLE_NAME, cols,
null, null, null, null, null);
return c;
}
public Cursor queryAll(int nameId) {
String[] cols = {openHelper_ob.KEY_ID, openHelper_ob.FNAME,
openHelper_ob.LNAME, openHelper_ob.COUNT};
opnToWrite();
Cursor c = database_ob.query(openHelper_ob.TABLE_NAME, cols,
openHelper_ob.KEY_ID + "=" + nameId, null, null, null, null);
return c;
}
public long updateldetail(int rowId, String fname, String lname, Integer count) {
ContentValues contentValues = new ContentValues();
contentValues.put(openHelper_ob.FNAME, fname);
contentValues.put(openHelper_ob.LNAME, lname);
contentValues.put(openHelper_ob.COUNT, count);
opnToWrite();
long val = database_ob.update(openHelper_ob.TABLE_NAME, contentValues,
openHelper_ob.KEY_ID + "=" + rowId, null);
Close();
return val;
}
public int deletOneRecord(int rowId) {
// TODO Auto-generated method stub
opnToWrite();
int val = database_ob.delete(openHelper_ob.TABLE_NAME,
openHelper_ob.KEY_ID + "=" + rowId, null);
Close();
return val;
}
}
答案 0 :(得分:4)
我认为您应该尝试在build.gradle中添加以下脚本。 (必须写在android {}标签中)
lintOptions {
abortOnError false
}
当你的发布版本通过lint生成错误时,构建任务不会中止。
答案 1 :(得分:0)
在课堂上添加:
public RegistrationAdapterr(){
}
在哪个类中找到相同的错误,只需创建默认构造函数,就像RegestrationOpenHelper一样:
public RegestrationOpenHelper(){
}
答案 2 :(得分:0)
在课堂上添加:
public RegistrationAdapterr(){}
to =>公共类RegistrationAdapterr
和
public RegestrationOpenHelper(Context context) {
super(context, DB_Name, null, DB_Ver);
}
to => class RegestrationOpenHelper