![](/img/trans.png)
[英]AAPT: error: attribute buttonColor (aka com.example.*appName*) not found
[英]Cause: cannot find com.example.exampleCombant.Appname.Database: com.example.example.appname.DataBase found in com/Database.class
我無法運行我的應用程序由於這個問題,我已經使用SQL lite Open Helper創建了一個SQL lite數據庫並添加了我需要的表,但是我無法運行該應用程序嗎? 我必須在周日完成應用程序才能將其發送給我的老師。 我試圖從測試設備中刪除該應用程序並重新安裝,並檢查了我的應用程序文件,但未找到任何內容
package com.mohnad.theeducationnewera.marksbook;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DataBase extends SQLiteOpenHelper {
private static final String database_name = "DB";
private static final int database_vesion =1;
private static final String UID = "id";
private static final String name = "Name";
private static final String work_mark = "Works Mark";
private static final String test_mark = "Tests mark";
private static final String tableName = "Students";
private Context context;
private static final String DROP_TABLE = "DROP TABLE IF EXISTS " +tableName;
private static final String CREATE_TABLE = "CREATE TABLE " +tableName+" " +
" ("+UID+" INTEGER PRIMARY KEY AUTOINCREMENT," +
" "+name+" TEXT VARCHAR(255))," +
" "+work_mark+" INTEGER ," +
" "+test_mark+" INTEGER ;";
public DataBase(Context context) {
super(context, database_name,null, database_vesion);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(DROP_TABLE);
}
}
首先,您必須確保清單中只有一個發射器
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
DBHelper中的第二名
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(DROP_TABLE);
//add line below
onCreate(db);
}
運行好運后給我反饋
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.