5

i am getting this Error

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getIdName()' on a null object reference

when i disable Instant Run i did not get any error my project works fine.

But i want to keep instant Run Enabled. I find some where that if i want to enabled Instant Run i have to un-check the

ReStart the Activity on code changes

but this did not work for me.

Any solution for this is highly appreciated.

Muazzam A.
  • 647
  • 5
  • 17

4 Answers4

8
  1. Verify your androidManifest, and add:

    <application... > <meta-data android:name="AA_MODELS" android:value="myfullpackage.myentity1, myfullpackage.myentity2 " />

  2. Verify if your class extends to Model and has constructor with super();
Pierry
  • 979
  • 7
  • 17
3

plus :increment your AA_DB_VERSION in your manifest. That will force ActiveAndroid regenerate your schema.

wonbin2011
  • 397
  • 3
  • 11
1

If you are using gradle 2.0, then add the following line to your AndroidManifest.xml file

<meta-data
    android:name="AA_MODELS"
    android:value="com.myspace.model.modelName"/>

android:value should be the path of your model class.

-2

Problem Solved

You don't have to turn off the instant run. Simply set

Inside application node in AndroidManifest.xml, uninstall the app before running.

Wasif Ali
  • 886
  • 1
  • 13
  • 29
Muazzam A.
  • 647
  • 5
  • 17