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)
How to solve this error?
SOLUTION Use Room Version: 2.4.0-alpha03 or later.
If you are using Apple M1 chip
One of the release notes they have mentioned by jetpack (Version 2.4.0-alpha03 )
Change Version to 2.4.0-alpha03 or above
implementation "androidx.room:room-runtime:2.4.0-alpha03"
annotationProcessor "androidx.room:room-compiler:2.4.0-alpha03"
kapt 'androidx.room:room-compiler:2.4.0-alpha03'
Reference
https://developer.android.com/jetpack/androidx/releases/room#version_240_2
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"
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'
}
}
}
Room [2.4.0-alpha04] fixed this issues.
And remove kapt "org.xerial:sqlite-jdbc:3.34.0"
Here is what worked for me:
Change room
version to 2.3.0
in app-level build.gradle
def room_version = "2.3.0" // for Room
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
In project-level build.gradle
, add the following configuration in allprojects
allprojects {
repositories {
// ...
}
// ADD THE FOLLOWING
configurations.all {
resolutionStrategy {
force 'org.xerial:sqlite-jdbc:3.34.0'
}
}
}
Clean & rebuild your project :)
Ref: this comment on Google IssueTracker
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With