DBFlow: [3.0.0-beta1]Table is not registered with a Database. Did you forget the @Table annotation?

But I have the folowing structure:

@Database(name = WeatherDB.NAME, version = WeatherDB.VERSION)
public class WeatherDB {

    public static final String NAME = "Weather";

    public static final int VERSION = 1;
}

And table:

@Table(database = WeatherDB.class)
public class WeatherTable extends BaseModel {

    @Column
    @PrimaryKey
    private long dateStamp;
    @Column
    private double dayTemperature;
    @Column
    private double minTemperature;
    @Column
    private double maxTemperature;
    @Column
    private double nightTemperature;
    @Column
    private double eveTemperature;
    @Column
    private double mornTemperature;
    @Column
    private int humidity;
    @Column
    private String description;
    @Column
    private double windSpeed;

   //getters and setters
}

Full stacktrace:

Process: me.bitfrom.weatherapp, PID: 3939
                                                                     com.raizlabs.android.dbflow.structure.InvalidDBConfiguration: Table: me.bitfrom.weatherapp.database.WeatherTable is not registered with a Database. Did you forget the @Table annotation?
                                                                         at com.raizlabs.android.dbflow.config.FlowManager.getDatabaseForTable(FlowManager.java:109)
                                                                         at com.raizlabs.android.dbflow.config.FlowManager.getModelAdapter(FlowManager.java:271)
                                                                         at com.raizlabs.android.dbflow.config.FlowManager.getTableName(FlowManager.java:68)
                                                                         at com.raizlabs.android.dbflow.sql.language.From.<init>(From.java:55)
                                                                         at com.raizlabs.android.dbflow.sql.language.Select.from(Select.java:58)
                                                                         at me.bitfrom.weatherapp.ui.fragments.TodaysWeatherFragment.onViewCreated(TodaysWeatherFragment.java:31)
                                                                         at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:908)
                                                                         at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
                                                                         at android.app.BackStackRecord.run(BackStackRecord.java:834)
                                                                         at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
                                                                         at android.app.FragmentManagerImpl$1.run(FragmentManager.java:447)
                                                                         at android.os.Handler.handleCallback(Handler.java:739)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                         at android.os.Looper.loop(Looper.java:211)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5389)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at java.lang.reflect.Method.invoke(Method.java:372)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 35 (9 by maintainers)

Most upvoted comments

Finally it works for me! I had forgotten to add the Application class on the manifest

<application android:name=“.App.TotoApp”:

+1 ProGuard rule fixed things for me. I suggest it be added a consumer proguard rule for the library?

-keep class * extends com.raizlabs.android.dbflow.config.DatabaseHolder { *; }

Having done some more experimentation, it seems not to be DBFlow at fault, but rather android-apt. As you alluded to, as of the gradle 2.2.x plugin, this lib is deprecated ( https://bitbucket.org/hvisser/android-apt/wiki/Migration ) and dagger fails the generation step when I include it. But when I try to add dbflow’s compile directives, i get: Error:(151, 0) Could not find method apt() for arguments [com.github.Raizlabs.DBFlow:dbflow-processor:4.0.0-beta2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Any suggestions for working with DBFlow using the newest gradle plugin?