Java.Lang.VerifyError on Android API 10

609 views Asked by At

I get the following error when executing android app on emulator Nexus S Platform 2.3.3 with api 10. It works well on Nexus 4 Android 4.3 with api 18. AppDatabase extends SQLiteOpenHelper.

Code:

 public class AppController extends Application {

     [...]

     private static AppDatabase mDbo;

     [...]
     try {
         // Here comes the crash, it crashes immediately, i cannot step into 
         mDbo = new AppDatabase( AppDatabase.NAME,null, new AppSQLiteCursor(),AppDatabase.VERSION) ;

      }
  }

Error stacktrace:

12-14 23:04:01.996    1372-1372/com.example.myapp E/APP_ERRORīš• VerifyError raised!
    java.lang.VerifyError: com.example.myapp.database.AppDatabase
            at com.example.myapp.AppController.onCreate(AppController.java:85)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3272)
            at android.app.ActivityThread.access$2200(ActivityThread.java:117)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:130)
            at android.app.ActivityThread.main(ActivityThread.java:3683)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:507)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
            at dalvik.system.NativeStart.main(Native Method)
1

There are 1 answers

0
spacebiker On BEST ANSWER

I finally found out the culprit for the VerifyError exception. It was due to SQLiteCantOpenDatabaseException, which was not included until API 11. Using only SQLiteException to catch the errors in AppDatabase class did the job.