Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64

Roman picture Roman · Aug 22, 2021 · Viewed 16.2k times · Source

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.

Answer

Arun NS picture Arun NS · Sep 11, 2021

If you are using Apple M1 chip

One of the release notes they have mentioned by jetpack (Version 2.4.0-alpha03 )

  • Fixed an issue with Room’s SQLite native library to support Apple’s M1 chips.

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