Android room persistent: AppDatabase_Impl does not exist

My app database class

@Database(entities = {Detail.class}, version = Constant.DATABASE_VERSION)
public abstract class AppDatabase extends RoomDatabase {

    private static AppDatabase INSTANCE;

    public abstract FavoritesDao favoritesDao();

    public static AppDatabase getAppDatabase(Context context) {
        if (INSTANCE == null) {
            INSTANCE =
                    Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, Constant.DATABASE).allowMainThreadQueries().build();

                    //Room.inMemoryDatabaseBuilder(context.getApplicationContext(),AppDatabase.class).allowMainThreadQueries().build();
        }
        return INSTANCE;
    }

    public static void destroyInstance() {
        INSTANCE = null;
    }
}

Gradle lib:

 compile "android.arch.persistence.room:runtime:+"   
 annotationProcessor "android.arch.persistence.room:compiler:+"

And when i ask for instance it will give this error, AppDatabase_Impl does not exist
in my application class

public class APp extends Application {

    private boolean appRunning = false;

    @Override
    public void onCreate() {
        super.onCreate();
        AppDatabase.getAppDatabase(this); //--AppDatabase_Impl does not exist

    }   

}

26 Answers
26

Leave a Comment