gpt4 book ai didi

java - 在 android studio : This class should provide default constructor 中构建签名的 apk 时出错

转载 作者:行者123 更新时间:2023-11-29 03:11:37 26 4
gpt4 key购买 nike

错误:此类应提供默认构造函数(不带参数的公共(public)构造函数)(com.tasbih.counter.tasbihcounter.RegistrationAdapterr)[可实例化]

当我尝试构建签名的 apk 时会发生此错误,但在 Debug模式下该应用程序运行正常。请帮忙。

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;
}
}

最佳答案

我认为您应该尝试在 build.gradle 中添加以下脚本。 (必须写在android{}标签里)

lintOptions {
abortOnError false
}

当您的发布构建通过 lint 生成错误时,构建任务不会中止。

关于java - 在 android studio : This class should provide default constructor 中构建签名的 apk 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29046829/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com