ActiveAndroid
ActiveAndroid copied to clipboard
Android activeAndroid get TableInfo.getIdName() error
I'm trying to implementing ActiveAndroid
library on my project, after read more documentation about that, i get this error when i try to save data on database
com.activeandroid.TableInfo.getIdName()' on a null object reference
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.pishguy.XXX"
xmlns:android="http://schemas.android.com/apk/res/android">
..
<application
android:name=".Application"
...
<meta-data
android:name="AA_DB_NAME"
android:value="myDB.db"/>
<meta-data
android:name="AA_DB_VERSION"
android:value="1"/>
</application>
</manifest>
Application
class:
public void onCreate() {
super.onCreate();
...
ActiveAndroid.initialize(this);
}
DataBase model:
@Table(name = "MyClass")
public class MyClass extends Model {
@Column(name = "Name")
private String Name;
...
@Column(name = "updated_at")
private String updated_at;
public MyClass() {
super();
}
...
}
and then using that:
MyClass class = new MyClass();
class.setName (classItems.getString("name"));
...
class.setCreated_at(classItems.getString("created_at"));
class.setUpdated_at(classItems.getString("updated_at"));
...
I guess you are using Android studio and Gradle 2.0+.
you can specify your Model classes explicitely in your AndroidManifest:
@leezx1993 this library supported yet? or not?
you can specify your Model classes explicitely in your AndroidManifest: android:name="AA_MODELS" android:value="com.myapp.model.Item, com.myapp.model.Category" /> it will work well~
still its not working.. same error
same error