memtrip / SQLKing

SQLKing is an Android SQLite ORM powered by an annotation preprocessor, tables are defined by Table annotations and CRUD classes expose an expressive api for executing SQLite queries. @memtrip
Other
21 stars 9 forks source link

nullPointerException in Column.assembleIsIndex() #7

Open Trellian opened 8 years ago

Trellian commented 8 years ago

Hi Sam,

I'm getting the following error, and I can't see what is causing it, have you got any thoughts on this?

Caused by: java.lang.NullPointerException at com.memtrip.sqlking.preprocessor.processor.model.Column.assembleIsIndex(Column.java:60) at com.memtrip.sqlking.preprocessor.processor.model.Column.(Column.java:42) at com.memtrip.sqlking.preprocessor.processor.model.Table.assembleMembers(Table.java:57) at com.memtrip.sqlking.preprocessor.processor.model.Table.(Table.java:37) at com.memtrip.sqlking.preprocessor.processor.model.Data.assembleTables(Data.java:24) at com.memtrip.sqlking.preprocessor.processor.model.Data.(Data.java:16) at com.memtrip.sqlking.preprocessor.processor.Processor.process(Processor.java:40)

Also, please can you give tell me what the annotation syntax is for setting up foreign keys and indexes?

Thanks, Adrian

samkirton commented 8 years ago

Hi Adrian,

I merged this fix into master, I will make a new release to maven central tonight with the latest changes.

Cheers, Sam

samkirton commented 8 years ago

Hi Adrian,

I have made a new release that fixes these issues, use these dependencies: dependencies { apt 'com.memtrip.sqlking:preprocessor:1.0.6' compile 'com.memtrip.sqlking:client:1.0.6' }

Cheers, Sam

Trellian commented 8 years ago

Hi Sam,

I am still getting the same problem. I saw that the 1.0.6 release was indeed downloaded during precompile, so I'm sure I've got the fixes.

Error:java.lang.NullPointerException at com.memtrip.sqlking.preprocessor.processor.model.Column.assembleIsIndex(Column.java:60)

I'm obviously doing something wrong. Is it possible to add some debug info to the preprocessor, which can identify table and column names as they get handled? It would be useful for future debugging too, to identify a column that is not declared correctly.

samkirton commented 8 years ago

Are you sure that you are using the latest dependency? On master line 60 is white space: https://github.com/memtrip/SQLKing/blob/master/preprocessor/src/main/java/com/memtrip/sqlking/preprocessor/processor/model/Column.java#L60

Trellian commented 8 years ago

Pretty sure, yes. I have invalidated my caches and restarted Android Studio. When it started up again, I saw the msgs saying that it was downloading 1.0.6. Is there any other way to check?
Here is the contents of my app's build.gradle.

`apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt'

android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.thorburn.sanscan" minSdkVersion 17 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' debuggable false } debug { debuggable true minifyEnabled false } } // dexOptions { // javaMaxHeapSize "4g" //specify the heap size for the dex process // preDexLibraries false // } productFlavors { } }

dependencies { //compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile files('libs/gson-2.4.jar') apt "com.jakewharton:butterknife-compiler:8.0.1" apt 'com.memtrip.sqlking:preprocessor:1.0.4' //apt ':preprocessor' compile 'com.android.support:appcompat-v7:24.0.0-beta1' compile 'net.zetetic:android-database-sqlcipher:3.3.1-2' compile 'com.google.android.gms:play-services-vision:8.4.0' compile 'com.android.support:design:24.0.0-beta1' compile 'com.android.support:support-v4:24.0.0-beta1' compile 'com.neenbedankt.gradle.plugins:android-apt:1.4' compile 'joda-time:joda-time:2.9.3' compile 'com.jakewharton:butterknife:8.0.1' compile 'com.android.support:recyclerview-v7:24.0.0-beta1' compile 'com.firebase:firebase-client-android:2.3.1' compile 'com.memtrip.sqlking:common:1.0.6' compile 'com.memtrip.sqlking:client:1.0.6' } `

samkirton commented 8 years ago

apt 'com.memtrip.sqlking:preprocessor:1.0.4' needs to be 1.0.6

Trellian commented 8 years ago

aaaargh.. (facepalm) !!!!

Thanks, it's working now!!!

samkirton commented 8 years ago

Great news! I will add appropriate logging like you suggested before closing this issue.