Проблема приложения Android (Amazon)

Я новичок в разработке приложений для Android. Я пытался представить свое приложение в Amazon, но столкнулся с некоторыми проблемами. Буду очень признателен, если кто-нибудь поможет мне решить эту проблему.

Журнал ошибок от команды Amazon:

08-11 10:41:29.136 W/dalvikvm(3898): VFY: rejecting call to Lcom/amazon/android/Kiwi;.onActivityResult (Landroid/app/Activity;IILandroid/content/IntentZ
08-11 10:41:29.136 W/dalvikvm(3898): VFY: rejecting opcode 0x71 at 0x0000
08-11 10:41:29.136 W/dalvikvm(3898): VFY: rejected Lcom/android/mygroceries/DataBaseHelper;.onActivityResult (IILandroid/content/IntentV
08-11 10:41:29.136 W/dalvikvm(3898): Verifier rejected class Lcom/android/mygroceries/DataBaseHelper;
08-11 10:41:29.136 D/AndroidRuntime(3898): Shutting down VM
08-11 10:41:29.136 W/dalvikvm(3898): threadid=1: thread exiting with uncaught exception (group=0x400259f8)
08-11 10:41:29.136 E/AndroidRuntime(3898): FATAL EXCEPTION: main
08-11 10:41:29.136 E/AndroidRuntime(3898): java.lang.VerifyError: com.android.mygroceries.DataBaseHelper
08-11 10:41:29.136 E/AndroidRuntime(3898): at com.android.mygroceries.mainmenu.onCreatemainmenu( mainmenu.java)
08-11 10:41:29.136 E/AndroidRuntime(3898): at com.android.mygroceries.mainmenu.onCreate(mainmenu .java)
08-11 10:41:29.136 E/AndroidRuntime(3898): at android.app.Instrumentation.callActivityOnCreate(I nstrumentation.java:1069)
08-11 10:41:29.136 E/AndroidRuntime(3898): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:2751)
08-11 10:41:29.136 E/AndroidRuntime(3898): at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:2803)
08-11 10:41:29.136 E/AndroidRuntime(3898): at android.app.ActivityThread.access$2300(ActivityThr ead.java:135)
08-11 10:41:29.136 E/AndroidRuntime(3898): at android.app.ActivityThread$H.handleMessage(Activit yThread.java:2136)
08-11 10:41:29.136 E/AndroidRuntime(3898): at android.os.Handler.dispatchMessage(Handler.java:99 )
08-11 10:41:29.136 E/AndroidRuntime(3898): at android.os.Looper.loop(Looper.java:144)
08-11 10:41:29.136 E/AndroidRuntime(3898): at android.app.ActivityThread.main(ActivityThread.jav a:4937)
08-11 10:41:29.136 E/AndroidRuntime(3898): at java.lang.reflect.Method.invokeNative(Native Method)
08-11 10:41:29.136 E/AndroidRuntime(3898): at java.lang.reflect.Method.invoke(Method.java:521)
08-11 10:41:29.136 E/AndroidRuntime(3898): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:868)
08-11 10:41:29.136 E/AndroidRuntime(3898): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:626)
08-11 10:41:29.136 E/AndroidRuntime(3898): at dalvik.system.NativeStart.main(Native Method)
08-11 10:41:29.146 W/ActivityManager(97): Force finishing activity com.android.mygroceries/.mainmenu

мой файл активности базы данных:

public class DataBaseHelper extends SQLiteOpenHelper    {

    private static String DB_PATH = "/data/data/com.android.mydatabase/databases/";
    private static String DB_NAME = "knowLanguage.db";

    private SQLiteDatabase db; 
    private final Context myContext;


   /**
    * Constructor
    * Takes and keeps a reference of the passed context in order to access to the     application assets and resources.
    * @param context
    */
    public DataBaseHelper(Context context) {

    super(context, DB_NAME, null, 1);
    this.myContext = context;
    }   

    public void createDataBase() throws IOException{

    try {
    if(!this.checkDataBase()){
    try {
       this.getWritableDatabase(); 
       /*Log.i("DATABASE:", "WRITABLE");*/
    } catch(SQLiteException ex) {
      this.getReadableDatabase(); 
      /*Log.i("DATABASE:", "READABLE");*/
    }
    this.close();
    try {
       this.copyDataBase(myContext);
       /*Log.i("DATABASE:", "COPY");*/
     } catch (IOException e) {
       Log.e("Database Error:", "Error copying database");
      }  
     }
     this.close();
     } catch(SQLException eSQL){
     Log.e("log_tag","Can not open database");
     }
     }

      private boolean checkDataBase(){

        File dbFile = new File(DB_PATH+DB_NAME);
         return dbFile.exists(); 
       }


      public SQLiteDatabase copyDataBase(Context context) throws IOException,SQLiteException{

        if (db != null && db.isOpen()) {
           db.close();
           }

          File fileTest = context.getFileStreamPath(DB_NAME);
           boolean exists = fileTest.exists();

           if(exists==false)
             {  
                InputStream myInput = context.getAssets().open(DB_NAME, Context.MODE_PRIVATE);
                 OutputStream myOutput = new FileOutputStream(DB_PATH + DB_NAME);
                 byte[] buffer = new byte[1024];
               int length;

               while ((length = myInput.read(buffer)) > 0) {
                myOutput.write(buffer, 0, length);
              }

               myOutput.flush();
               myOutput.close();
               myInput.close();
            }

             return db = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null,                SQLiteDatabase.NO_LOCALIZED_COLLATORS);
           }

         public void openDataBase() throws SQLException{
           String myPath = DB_PATH + DB_NAME;
            db = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
         }

       @Override
         public synchronized void close() {
             if(db != null && db.isOpen())
                db.close();
                super.close();
             }

         @Override
           public void onCreate(SQLiteDatabase db) {

             }

          @Override
            public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

              }

           }

0 ответов

Другие вопросы по тегам