我遇到Android Room问题。我正在尝试从预先填充的SQLITE数据库迁移。
class IpMap(Table, BaseModel):
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
代码行:
import android.arch.persistence.db.SupportSQLiteDatabase;
import android.arch.persistence.room.Database;
import android.arch.persistence.room.Room;
import android.arch.persistence.room.RoomDatabase;
import android.arch.persistence.room.migration.Migration;
@Database(entities = {Attributes.class}, version = 2)
public abstract class AppDatabase extends RoomDatabase {
private static AppDatabase INSTANCE;
public abstract AttributesDao attributesDao();
Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "Attributes.db")
.addMigrations(MIGRATION_1_2).build();
static final Migration MIGRATION_1_2 = new Migration(1, 2) {
@Override
public void migrate(SupportSQLiteDatabase database) {
}
};
}
犯了很多错误。知道是什么原因引起的吗?
错误:Build Errors