-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getIdName()' on a null object reference #461
Comments
I am also getting this error. |
I actually switched to Realm. It seems ActiveAndroid is not maintained anymore. |
Maybe @svendvd could give us insights how his fix works :-) |
It was working fine for me before now I updated DB model and am getting the above error. my app is almost complete. |
I fixed my issue. It was because my model classes where not loading properly in to active android. |
Hi this is my simple workaround. |
Hello, Thanks. |
@sakkeerhussain Can you tell me, how do you fix it? |
@Christ9038 I was added my models name in manifest with AA_Model tag. Even though Model names are correct the path to the model classes where not correct. I just corrected that and solved my issue. |
@sakkeerhussain It solved my issue! Thank you so much. |
@Christ9038 Great to here this from you. Thanks, On 6 April 2016 at 19:48, Christ9038 notifications@github.com wrote:
|
Hi @sakkeerhussain do you mean something like this? |
The same happened with me when I upgraded to Android Studio 2.0 |
Is it AA_Model or AA_MODELS ? |
I have same problem with upgrade on 2.0. I've updated manifest like this:
And it works UPD: also i've changed back gradle version to 1.5 |
@strgen what a db name hehe. I re-installed android 1.5.1 and its working just like before. I think I will release the app for now and later will change to Realm since AA is discontinued. |
@xahy, what database name in your opinion is right? :) I'm using it for test when you need clear db. |
have same problem with upgrade on Android Studio 2.0. |
@sebastiandeutsch @xahy solved ! If your project have ModelAxx, ModelBxx, ModelCxx... you can write at Manifest.xml just like:
|
@xushaojie I tried that, and still it was showing the same error. I can install Studio 2.0 again and try that. Will post here if its working. @strgen 🤓 |
@xahy contains all models? check code again. |
@soygustavo like this include full path to your model classes. |
@sakkeerhussain It resolves the issue but slows down the startup of my app a lot. Another solution is to disable the Instant Run in Android Studio. |
@xushaojie thanks your solution is work ! 💃 |
@sakkeerhussain thanks but now i have another error java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.myproject.dataStorage.Preference.getValue()' on a null object reference android.database.sqlite.SQLiteException: no such table: Preferences (code 1): , while compiling: SELECT * FROM Preferences any ideas? UPDATE: |
Disable instant run will fix the problem. Have to ways to do this. One in preferences on android studio. and other way to change your gradle version to 2.0.0 (this also remove instant run) |
i have solved my issue if u r using ur own Application class than ActiveAndroid.initialize(this); complete code public class MyApplication extends Application {
} |
thanks @xushaojie works for me |
adding AA_MODELS to Manifest did solve this issue. |
@pynixwang Can you give me an example of how you put the paths of your clases , i've tried something like "com.mypackage.models.db.ClassName1,com.mypackage.models.db.ClassName2" I'm using Android studio 2.2.3, Instant run disabled, Gradle version 1.5.0. Error: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getTableName()' on a null object reference |
@Gustavol95 just the class name contain package,but gradle version is 2.1.4。 |
@Gustavol95 try to upgrade your gradle version and enable instant run,if I disable instant run ,there is no issue,but install apk everytime is not acceptable,it is too slow. |
gettting every time same error : java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getIdName()' on a null object reference |
@PratikPagada see my code.maybe useful. |
try with this add this code in AndroidManifest.xml
and this code into you application class
|
Hi @derohimat Configuration dbConfiguration = new Configuration.Builder(this) --> in this line , Configuration which library. Not found application. |
Disable Instant Run in AndroidStudio solved it |
you must add the model into AndroidMenifest.xml,just like this : |
check the Manifest, if your Application class is add my Class is:
} |
please declare name in manifest.xml > name =".NameApplicaionClass" |
android:value="aplicativo.oneplace.Entidades.USUARIO_CHAT_AMIGO_MENSAGEM,aplicativo.oneplace.Entidades.AMIGOS_USUARIO_SQLITE" this is not working for me, just this model is working = USUARIO_CHAT_AMIGO_MENSAGEM this = AMIGOS_USUARIO_SQLITE not working... its the same package |
@lucazin check that this line is in a single line, I think it does not work in several lines |
you should turn off InstanceRun .For me worked . |
can anyone help me figure out this error |
I had the same problem when I changed the location of the model. Double check in AndroidManifest.xml if the {modeLocation} is the same as the location in your directory. |
Hi,
I'm getting a strange NullPointer exception on a fresh application that I'm creating (AndroidStudio 2/Android 6.0.1). Any thing that I'm missing?
Best
Sebastian
The text was updated successfully, but these errors were encountered: