这篇文章上次修改于 1209 天前,可能其部分内容已经发生变化,如有疑问可询问作者。

截止发稿时 Room 的最新版本为 2.3.0-alpha04,这个版本无法在 Apple Silicon 中使用。

2021-01-03T07:36:16.png

看了一下 Room 的 Sqlite Jdbc 版本为 3.25.2。

然后查看了一下 Sqlite Jdbc Releases 他是在 3.32.3.3 版本中开始兼容 Apple Silicon M1 芯片的。

我们可以自己单独引用 Jdbc,只要引用的版本高于 3.32.3.3 即可解决这个问题。

implementation("androidx.room:room-runtime:2.3.0-alpha04") {
    exclude(group:'org.xerial')
}
kapt("androidx.room:room-compiler:2.3.0-alpha04"){
    exclude(group:'org.xerial')
}
implementation("androidx.room:room-ktx:2.3.0-alpha04"){
    exclude(group:'org.xerial')
}
implementation 'org.xerial:sqlite-jdbc:3.34.0'