所以我想刪除我的房間持久表,這顯然使我這個所有項目:刪除表時受限制的API lint錯誤。客房持久
@Dao
interface MyDao {
@Query("DELETE FROM myTableName")
public void nukeTable();
}
不過運行,我面對的是一個受限制的./gradlew皮棉時API失敗,如下所示。
1.My代碼
@Dao
public interface AlertDao {
@Insert
void insert(List<Alert> alert);
@Query("SELECT * FROM alert")
List<Alert> queryAll();
@Query("DELETE FROM alert")
void deleteTable();
}
- 我的皮棉錯誤
受限API ../generated/source/ apt/debug/com/app/test/storage/dao/AlertDao_Impl.java:> 84:SharedSQLiteStatement.acquire只能從相同的庫組中調用(groupId = android.arch.persistence.room) 82 @Override 83 public void deleteTable(){ 84 final SupportSQLiteStatement _stmt => __ preparedStmtOfDeleteTable.acquire();
85 __db.beginTransaction(); 86 try {__ __ __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _../generated/source/apt/debug/com/app/test/storage/dao/AlertDao_Impl.java:91:SharedSQLiteStatement.release只能從同一個庫組中調用(groupId = android.arch .persistence.room) 88 __db.setTransactionSuccessful(); 89} finally { 90 __db.endTransaction(); 91 __preparedStmtOfDeleteTable.release(_stmt);
92} 93}../generated/source/apt/debug/com/app/test/storage/dao/AlertDao_Impl.java:98:RoomSQLiteQuery只能從同一庫組中調用(公共列表queryAll(){ 97 final String _sql =「SELECT * FROM alert」; 98 final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql,0);
99 final Cursor _cursor = __db.query(_statement); 100嘗試101 final int _cursorIndexOfAutoGeneratedKey = _cursor.getColumnIndexOrThrow(「autoGeneratedKey」);../generated/source/apt/debug/com/app/test/storage/dao/AlertDao_Impl.java:134:RoomSQLiteQuery.release只能從同一個庫組中調用(groupId = android.arch .persistence.room) 131 return _result; 132} finally { 133 _cursor.close(); 134 _statement.release();
135} 136} 137}
任何幫助,將不勝感激。
Regards
謝謝你的反饋禁用
RestrictedApi
作爲解決方法,現在,伊利諾伊州添加lintOption並應協助我的CI。 – Gotama