I have two APKs. First APK is a main APK which loads second APK. In the second APK I have next code:
@Entity
public class RequestEntity {
@PrimaryKey
@NonNull
public String uid;
@ColumnInfo(name = "bucketName")
public String bucketName;
@ColumnInfo(name = "key")
public String key;
@ColumnInfo(name = "stream")
public byte[] stream;
@ColumnInfo(name = "metadata")
public byte[] metadata;
public RequestEntity(String bucketName, String key, byte[] stream, byte[] metadata) {
this.uid = bucketName + key;
this.bucketName = bucketName;
this.key = key;
this.stream = stream;
this.metadata = metadata;
}
}
@Dao
public interface RequestDao {
@Query("SELECT * FROM requestEntity")
List<RequestEntity> getAll();
@Query("SELECT * FROM requestEntity WHERE uid IN (:requestIds)")
List<RequestEntity> loadAllByIds(int[] requestIds);
@Insert
void insert(RequestEntity requestEntitie);
@Insert
void insertAll(RequestEntity... requestEntities);
@Delete
void delete(RequestEntity user);
}
@Database(entities = {RequestEntity.class}, version = 2, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
public abstract RequestDao requestDao();
}
My problem is when I call this line in the second APK:
db = Room.databaseBuilder(context, AppDatabase.class, "database-name").build();
I get exception:
java.lang.RuntimeException: cannot find implementation for [my package name].AppDatabase. AppDatabase_Impl does not exist
If I copy my code to main APK and call to this line from main APK, everything OK.
Aucun commentaire:
Enregistrer un commentaire