'How can I solve this issue on Mac M1 Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64

I solved this issue with the code below in my build.gradle

  allprojects {
configurations.all {
    resolutionStrategy {
        force 'org.xerial:sqlite-jdbc:3.34.0'
      }
   }
 } 

But it has an effect on the project I am working on. for some reason, it is not working with room sql implemented on the project.

I get this error when i removed the code above.

Is there a better approach to solve this.

Caused by: java.lang.ExceptionInInitializerError
at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:82)
at androidx.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:57)
at androidx.room.RoomProcessor$DatabaseProcessingStep.process(RoomProcessor.kt:134)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:161)
at 

 

jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:980) ... 39 more

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:68)
... 47 more


Solution 1:[1]

update your room library

   implementation "androidx.room:room-runtime:2.4.2"
   implementation "androidx.room:room-ktx:2.4.2"
   kapt "androidx.room:room-compiler:2.4.2"

Here is Reference

Solution 2:[2]

yeb run working on my case(my mac mini m1) =>>> implementation "androidx.room:room-runtime:2.4.2" implementation "androidx.room:room-ktx:2.4.2"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Music C