daw*_*awn 21 android android-gradle-plugin android-room androidx
我不断收到此错误。我正在从事一个项目,在开发过程中,我决定迁移到AndroidX。
我收到以下错误:
Note: Failed to read get kotlin metadata for [Ljava.lang.Object;@79d6c4df
Run Code Online (Sandbox Code Playgroud)
在实体文件中存在相同的错误,在相应的DAO中也存在4个相同的错误。
这是DAO的代码:
@Dao
public interface FlockDao{
@Query("SELECT * FROM flock_table")
LiveData<List<Flock>> getAllFlocks();
@Query("SELECT * FROM flock_table WHERE fid IN (:flockIds) LIMIT 1")
Flock loadFlockById(int[] flockIds);
@Insert
void insert(Flock flock);
@Update
void update(Flock flock);
@Delete
void delete(Flock flock);
}
Run Code Online (Sandbox Code Playgroud)
我的实体是:
@Entity
public class Flock{
@PrimaryKey(autoGenerate = true)
private int fid;
@ColumnInfo(name = "user_id")
private int uid;
@ColumnInfo(name = "name")
private String name;
@ColumnInfo(name = "capacity")
private int capacity;
@ColumnInfo(name = "type")
private String type;
@ColumnInfo(name = "arrived")
private Date arrived;
.....rest of the code is omitted, there are constructor, setters and getters
}
Run Code Online (Sandbox Code Playgroud)
Ren*_*Rei 32
我将我的房间分辨率更新为2.1.0-alpha05,并遇到了同样的问题。返回2.1.0-alpha04解决了我的问题。
implementation 'androidx.room:room-runtime:2.1.0-alpha04'
annotationProcessor 'androidx.room:room-compiler:2.1.0-alpha04'
Run Code Online (Sandbox Code Playgroud)
更新 如果您确实要使用Room版本2.1.0-alpha05,请在您的项目存储库中添加以下依赖关系:
maven { url 'https://kotlin.bintray.com/kotlinx/' }
Run Code Online (Sandbox Code Playgroud)
更新 我尝试了2.1.0-alpha06。
implementation 'androidx.room:room-runtime:2.1.0-alpha06'
annotationProcessor 'androidx.room:room-compiler:2.1.0-alpha06'
Run Code Online (Sandbox Code Playgroud)
然后,将依赖关系添加到我的项目存储库中,
maven { url 'https://kotlin.bintray.com/kotlinx/' }
Run Code Online (Sandbox Code Playgroud)
没有错误,但已编译。我在真实设备上测试了我的应用程序数周,并且运行我的应用程序没有任何问题。我的会议室数据库运行正常。
小智 9
我通过降级为以下解决了这个问题:
implementation 'androidx.room:room-runtime:2.1.0-alpha04'
annotationProcessor 'androidx.room:room-compiler:2.1.0-alpha04'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5937 次 |
| 最近记录: |