引起:java.lang.Exception:没有找到 os.name=Mac 和 os.arch=aarch64 的本机库.路径=/org/sqlite/native/Mac/aarch64 [英] Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64
问题描述
我正在使用 Android Studio [Android Studio Arctic Fox |2020.3.1 补丁 1]
I am using Android Studio [Android Studio Arctic Fox | 2020.3.1 Patch 1]
My room library version is [2.3.0]
Used Gradle version [7.0.1]
Also added kapt 'org.xerial:sqlite-jdbc:3.36.0.1'
Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64 at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:333) at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64) at androidx.room.verifier.DatabaseVerifier.<clinit>(DatabaseVerifier.kt:71)
如何解决这个错误?
解决方案使用 Room 版本:2.4.0-alpha03 或更高版本.
SOLUTION Use Room Version: 2.4.0-alpha03 or later.
推荐答案
更新(2021 年 10 月 26 日)-似乎 Room 在最新更新中得到了修复,因此,您可以考虑将 Room 更新到最新版本:---- 2.4.0-alpha03 ---- 或以上
Update(26 October 2021) - it seems that Room got fixed in the latest updates, Therefore you may consider updating Room to the latest version : ---- 2.4.0-alpha03 ---- or above
对于那些面临这个问题的人,您现在可以简单地在房间编译器之前添加这一行作为解决方法:
For those who are facing this problem, you can simply add this line before the room-compiler as a workaround now:
kapt "org.xerial:sqlite-jdbc:3.34.0"
如果上述解决方法不起作用,我建议改用此解决方法,将其添加到根 build.gradle.这将强制在整个项目中使用给定的依赖项:
If the mentioned workaround not working, I recommend using this workaround instead, adding it to the root build.gradle. This will force using the given dependency in the whole project:
allprojects {
configurations.all {
resolutionStrategy {
force 'org.xerial:sqlite-jdbc:3.34.0'
}
}
}
这篇关于引起:java.lang.Exception:没有找到 os.name=Mac 和 os.arch=aarch64 的本机库.路径=/org/sqlite/native/Mac/aarch64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!