I have not posted in quite a while, but I've been quite busy working on a few cool projects. I'll be posting about those in the coming months, after my exams.
In the meantime, I feel compelled to address a problem that I have spent countless (not really, I actually counted) hours poring over.
I've been coding an Android app that used SugarORM. It's a very nice ORM for Android and I see no reason not to use it. Except that it didn't work. Except when it did. It was a very confusing and frustrating time.
I've been having problems where Sugar simply does not create the tables and I get an error message about tables not being created.
FATAL EXCEPTION: main Process: com.chaijiaxun.pm25tracker, PID: 21680 android.database.sqlite.SQLiteException: no such table: SENSOR_READING (code 1): , while compiling: SELECT * FROM SENSOR_READING
When it finally does work, and I needed to migrate the database, it kept telling me the new fields I entered did not exist. Almost as if SugarORM was not creating the new database.
Searching for my problem provided many solutions. One of which was to increase my database version number to assist in migrations. This did not work.
SugarORM is not compatible with Android Studio's Instant Run. Turn it off.
For those interested, I'm using Sugar v1.4 and Android Studio 2.3
Android Studio 2.3 Build #AI-162.3764568, built on February 24, 2017 JRE: 1.8.0_112-release-b06 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
I do hope this solves someone's problems. I can't be the only one using SugarORM with Instant Run can I?