Objectbox-java: ToOne<T> or ToMany<T> relation is null

Created on 14 May 2018  路  6Comments  路  Source: objectbox/objectbox-java

I have tried to run the exmaple project in AndroidStudio and it works perfectly. However, I want to try the java-plain testing project in IntelliJ again and here is the source code.
It can build successfully, but I encountered a NullPointException like #205 , because of ToOne<Note> and ToMany<Note> are both null.
image
I feel so much confused.

All 6 comments

Please try to run the Gradle target, like ./gradlew java-main:run - AndroidStudio is not good with Java projects.

I create a new project in IntelliJ, not AndroidStudio. Here is source code.

I will have a more detailed look later, but I guess this is because by default IntelliJ uses its own build tools and not Gradle. Try to enable the delegate actions to Gradle option in File | Settings | Build, Execution, Deployment | Build Tools | Gradle | Runner.

Edit: yeap, confirmed project linked above works this way.
-ut

@greenrobot-team You are right. I found the cause of the problem. Thank you

How to enable delegating actions in newest Android Studio? There is no such option anymore

@TKolbusz Android Studio does this by default.

Anyhow, if you are writing a plain Java project (like op) I recommend using IntelliJ IDEA instead as Android Studio is optimized for Android projects.
-ut

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arnis71 picture arnis71  路  17Comments

GerritDeMeulder picture GerritDeMeulder  路  20Comments

chiara-jm picture chiara-jm  路  17Comments

greenrobot picture greenrobot  路  27Comments

DJafari picture DJafari  路  29Comments