Tables are not created on version 4.x version of Android, while this works on 5 of Android
See original GitHub issueHi All
SugarORM is quiet useful library and thanks you all guys for awesome work. I have an issue, While testing with Android ver. 5.x library works fine. data storing and retrieving all are working fine
Now later, while i was testing with Android ver 4.x API 18 of Android, the app crashes saying “Unfortunately --app-- has stopped” message. (No exception is thrown)
Reason for the error is no tables are created, in the SQLite database - Sugar.db contains only one table named - “android_metadata” . but required domain tables were not created.
And weird behaviour noticed while debugging is, when I put a breakpoint on the first line to access domain class
Product product = Product.first(Product.class); //Which is the first line to use the SugarOrm library and used from OnCreate method of first activity
If i put a break point at that point, I don’t know how but it creates the tables in SQLite.
Can anyone advice how to debug and fix the issue. Following is the logcat error message
01-31 12:58:32.174 26016-26016/com.wariyum.signage E/AndroidRuntime: FATAL EXCEPTION: main Process: com.wariyum.signage, PID: 26016 java.lang.ExceptionInInitializerError at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:251) at com.orm.util.ReflectionUtil.getDomainClass(ReflectionUtil.java:270) at com.orm.util.ReflectionUtil.getDomainClasses(ReflectionUtil.java:254) at com.orm.SchemaGenerator.createDatabase(SchemaGenerator.java:37) at com.orm.SugarDb.onCreate(SugarDb.java:26) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164) at com.orm.SugarDb.getDB(SugarDb.java:36) at com.orm.SugarRecord.find(SugarRecord.java:189) at com.orm.SugarRecord.listAll(SugarRecord.java:94) at com.wariyum.signage.global.Global.getAppSettings(Global.java:54) at com.wariyum.signage.LoginActivity.onCreate(LoginActivity.java:57) at android.app.Activity.performCreate(Activity.java:5280) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2322) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410) at android.app.ActivityThread.access$800(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5388) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:655) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IllegalStateException: java.lang.NoSuchMethodException: addLikelySubtags [class java.util.Locale]
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
You can follow this script to get the tables created by Sugar.
You can always set a breakpoint while debugging in Android Studio, and try to figure it out what is really happening
+1
set the meta-data under application tag, it is working!!!