简体   繁体   English

原因:找不到com.example.exampleCombant.Appname.Database:com / Database.class中找到com.example.example.appname.DataBase

[英]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.

相关问题 AAPT:错误:找不到属性 buttonColor(又名 com.example.*appName*) - AAPT: error: attribute buttonColor (aka com.example.*appName*) not found com.example.appname.MainActivity.onCreate 上的 AndroidRuntime 错误 - AndroidRuntime error at com.example.appname.MainActivity.onCreate 索引 51 处的非法字符 &lt;:&gt;:com.example.AppName.app-mergeDebugResources-29:/values/values.xml - Illegal char <:> at index 51: com.example.AppName.app-mergeDebugResources-29:/values/values.xml 由以下原因引起的错误:在 com.example.AppName.MainActivity.onCreate(MainActivity.java:20) - Error caused by : at com.example.AppName.MainActivity.onCreate(MainActivity.java:20) Android 在 com.example.appname.MainActivity.onCreate(MainActivity.java:21) 处出错 - Android Error at at com.example.appname.MainActivity.onCreate(MainActivity.java:21) Android 包括布局:使用数据绑定传递可绘制参数给出错误:AAPT:错误:找不到属性 mysrc(又名 com.example.APPNAME:mysrc) - Android include layout: pass Drawable parameter using data binding gives error: AAPT: error: attribute mysrc (aka com.example.APPNAME:mysrc) not found 加载:找不到类com.example.helloworld.HelloWorld.class - load: class com.example.helloworld.HelloWorld.class not found 无法创建类 com.example.architectureexample.NoteViewModel 的实例 - Cannot create an instance of class com.example.architectureexample.NoteViewModel 无法找到或加载主类com.example.dlp.Inspect - Could not find or load main class com.example.dlp.Inspect 黄瓜:找不到类 com.example.runner.RunnerTest - Cucumber: Class not found com.example.runner.RunnerTest
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM