ActiveAndroid icon indicating copy to clipboard operation
ActiveAndroid copied to clipboard

Android activeAndroid get TableInfo.getIdName() error

Open pishguy opened this issue 7 years ago • 5 comments

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"));

    ...

pishguy avatar Oct 17 '16 16:10 pishguy

I guess you are using Android studio and Gradle 2.0+. you can specify your Model classes explicitely in your AndroidManifest:

BryceLee avatar Oct 18 '16 03:10 BryceLee

@leezx1993 this library supported yet? or not?

pishguy avatar Oct 18 '16 18:10 pishguy

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~

BryceLee avatar Oct 23 '16 13:10 BryceLee

still its not working.. same error

sunil6525 avatar Dec 19 '16 07:12 sunil6525

same error

sourena21 avatar Dec 12 '17 06:12 sourena21