question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tables are not created on version 4.x version of Android, while this works on 5 of Android

See original GitHub issue

Hi 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:closed
  • Created 8 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sibeliuscommented, Jan 31, 2016

You can follow this script to get the tables created by Sugar.

  • Make sure your model classes have an empty constructor
  • Make sure your Application class extends SugarApp or call SugarContext.init at onCreate of Application

You can always set a breakpoint while debugging in Android Studio, and try to figure it out what is really happening

1reaction
sutthichaicommented, Feb 9, 2016

+1

set the meta-data under application tag, it is working!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Device compatibility overview - Android Developers
Each successive version of Android provides compatibility for apps that were built using the APIs from previous platform versions, so your app should...
Read more >
Android SQLite Database, WHY drop table and recreate on ...
Lets say in your DbHelper class you define that your database is version 1, ... Check this link for that -> Insert new...
Read more >
Requirements for Google Nest and Chromecast devices
The table below outlines the minimum requirements to install and use the Nest app on different devices. Android phones and tablets. Phone or...
Read more >
Identifying Fire Tablet Devices - Amazon Developer
Fire Tablet Build Model Android Version, API level La... Fire HD 8 (2022, 12th Gen) KFRAWI (2GB), KFRAPWI (3GB) Android 11, API Level 30...
Read more >
The Absolute Best Android Note Taking Apps for 2023
5. Zoho Notebook. OS: Android, iPhone, iPad, MacOS, Windows, Linux, Web version. Not as minimalist as Google Keep, yet ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found