[英]Cause: cannot find com.example.exampleCombant.Appname.Database: com.example.example.appname.DataBase found in com/Database.class
I can't run my app Because of this problem i have created an SQL lite data base using SQL lite Open Helper and added the table that i need but i can't run the app any help please? 我无法运行我的应用程序由于这个问题,我已经使用SQL lite Open Helper创建了一个SQL lite数据库并添加了我需要的表,但是我无法运行该应用程序吗? i have to finish the app on Sunday to give it to my teacher.
我必须在周日完成应用程序才能将其发送给我的老师。 I have tried to delete the app from my testing device and re installing it, and checked my app files but found nothing
我试图从测试设备中删除该应用程序并重新安装,并检查了我的应用程序文件,但未找到任何内容
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);
}
}
first you must be sure that manifest have only one LAUNCHER 首先,您必须确保清单中只有一个发射器
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
second in DBHelper DBHelper中的第二名
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(DROP_TABLE);
//add line below
onCreate(db);
}
give me the feed back after run it good luck 运行好运后给我反馈
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.