我如何解决 Mac M1 上的这个问题 Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64

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

我在 build.gradle

中使用下面的代码解决了这个问题
  allprojects {
configurations.all {
    resolutionStrategy {
        force 'org.xerial:sqlite-jdbc:3.34.0'
      }
   }
 } 

但是对我正在做的项目有影响。出于某种原因,它不适用于项目中实施的房间 sql。

当我删除上面的代码时出现此错误。

有没有更好的办法解决这个问题

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 个

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

更新您的房间库

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

这里是Reference

是的 运行 正在处理我的案例(我的 mac mini m1) =>>> implementation "androidx.room:room-runtime:2.4.2" implementation "androidx.room:room-ktx:2.4.2"