RushOrm
RushOrm copied to clipboard
Crash within RushCore.initialize() in Android 6.0.1
Hi Stuart,
Love Rush-ORM. But am getting a crash within RushCore.initialize() in Android 6.0.1. This didn't happen in the earlier versions (4.2+).
The call to RushCore.initialize() is within the onCreate() method - like so
public class App extends Application { @Override public void onCreate() { ....... AndroidInitializeConfig config = new AndroidInitializeConfig( this.getApplicationContext() ) ; RushCore.initialize(config) ; // <--- crashes here } }
** Below is the stack-trace from Android Studio. **
05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at java.lang.Class.classForName!(Native method) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at java.lang.Class.forName(Class.java:324) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at co.uk.rushorm.android.AndroidRushClassFinder.getRushClass(AndroidRushClassFinder.java:58) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at co.uk.rushorm.android.AndroidRushClassFinder.getRushClasses(AndroidRushClassFinder.java:45) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at co.uk.rushorm.android.AndroidRushClassFinder.findClasses(AndroidRushClassFinder.java:36) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at co.uk.rushorm.core.RushCore.loadAnnotationCache(RushCore.java:462) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at co.uk.rushorm.core.RushCore.initialize(RushCore.java:122) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at co.uk.rushorm.core.RushCore.initialize(RushCore.java:80) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at com.gradians.prepwell.Prepwell.onCreate(Prepwell.java:36) 05-06 08:30:34.603 5779-5779/com.gradians.prepwell A/art: art/runtime/runtime.cc:399] at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
I have the same problem.
Hi,
Very sorry for the late replay!!
Have a look here:
http://www.rushorm.com/advanced.html#Troubleshooting
Directly setting your Rush classes should resolve this. The plan for the future is define your model package in the manifest to resolve this.
Thanks
Then, i have other question for you.
I have my classes like
public class Item implements Parcelable extends RushObject
And, then, following that link i have
List<Class<? extends Rush>> classes = new ArrayList<>(); // Add classes classes.add(Item.class);
This gives me an error saying that Item
should extend Rush
.
How should this be done?
Hi,
I that works for me when I copy it. Other than changing Item to
public class Item extends RushObject implements Parcelable {}
Could you have imported the wrong 'Item' class?
Thanks
Hi, No, now works, but i had the impression that on the other day was causing problems :S Anyway, to me this works! :)
stuart-apadmi [email protected] escreveu no dia terça, 17/05/2016 às 14:48:
Hi,
I that works for me when I copy it. Other than changing Item to
public class Item extends RushObject implements Parcelable {}
Could you have imported the wrong 'Item' class?
Thanks
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/Stuart-campbell/RushOrm/issues/110#issuecomment-219722753
Hi Stuart,
I have not been as lucky with my testing on 6.0.1.
I followed your suggestion and modified the code to be as below
List<Class<? extends Rush>> dbClasses = new ArrayList<Class<? extends Rush>>() ;
dbClasses.add(Parcel.class) ;
dbClasses.add(Riddle.class) ;
dbClasses.add(Skill.class) ;
dbClasses.add(Usage.class) ;
dbClasses.add(User.class) ;
dbClasses.add(Zip.class) ;
AndroidInitializeConfig config = new AndroidInitializeConfig(mContext) ;
config.setClasses(dbClasses) ;
RushCore.initialize(config) ;
Then I did a fresh build (clean + make) of my project. Got the following error messages in the first run.
05-18 23:28:41.671 2312-2740/com.gradians.prepwell E/AndroidRuntime: FATAL EXCEPTION: Thread-1664 Process: com.gradians.prepwell, PID: 2312 java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String co.uk.rushorm.core.AnnotationCache.getTableName()' on a null object reference at co.uk.rushorm.core.implementation.ReflectionTableStatementGenerator.generateStatements(ReflectionTableStatementGenerator.java:50) at co.uk.rushorm.core.RushCore.createTables(RushCore.java:470) at co.uk.rushorm.core.RushCore.access$200(RushCore.java:39) at co.uk.rushorm.core.RushCore$1.run(RushCore.java:130) at java.lang.Thread.run(Thread.java:818) 05-18 23:28:47.665 2312-2739/com.gradians.prepwell E/GAv4: Successfully bound to service but never got onServiceConnected callback
*Compiled again (no clean, just make) and re-launched * _The app launches but crashes when it is time to save the first User record _ (error messages below)
The said class (User) class is declared as follows
public class User extends RushObject implements IUpload
05-18 23:36:20.457 8333-8333/com.gradians.prepwell E/AndroidRuntime: FATAL EXCEPTION: main Process: com.gradians.prepwell, PID: 8333 co.uk.rushorm.core.exceptions.RushClassNotFoundException: Rush class User was not found. Please make sure that if you are using setClasses on RushInitializeConfig you include this class. at co.uk.rushorm.core.implementation.Insert.ReflectionSaveStatementGenerator.joinFromField(ReflectionSaveStatementGenerator.java:175) at co.uk.rushorm.core.implementation.Insert.ReflectionSaveStatementGenerator.generateSaveOrUpdate(ReflectionSaveStatementGenerator.java:95) at co.uk.rushorm.core.implementation.Insert.ReflectionSaveStatementGenerator.generateSaveOrUpdate(ReflectionSaveStatementGenerator.java:54) at co.uk.rushorm.core.RushCore.save(RushCore.java:511) at co.uk.rushorm.core.RushCore.save(RushCore.java:177) at co.uk.rushorm.core.RushCore.save(RushCore.java:172) at co.uk.rushorm.core.RushObject.save(RushObject.java:12) at com.gradians.prepwell.activity.Launch.onConnected(Launch.java:242)
The problem seems to be limited to the User class. Commenting all references to User out lets me go ahead. But in terms of declaration,
public class User extends RushObject implements SomeInterface
it is quite like the other classes that were passed to RushInitialize(). So, I am flummoxed.
The only difference between User and other classes is that
- there is only one User record in the whole User table
- the first record is created in response to a Google+ API request. Basically, I get the name / email etc. from Google and store it locally on the phone
Is it possible that the User table is not ready when response from Google+ is got back? I mean, is RushInitialize() an asynchronous operation?
HAve you resolved the problem 3 years after ? I experiencing the same result