Java教程

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

本文主要是介绍Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

编译项目报错:

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

 

原因:

使用M1 处理器的mac,

room当前版本的room library还没支持.

 

  • 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'

 

但升级后,需要

androidCompileSdkVersion

升级到30/31才可以。

若不想升级SDK版本.

可以使用Room2.3.0版本

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"
allprojects {
    repositories {
        // ...
    }

    // ADD THE FOLLOWING
    configurations.all {
        resolutionStrategy {
            force 'org.xerial:sqlite-jdbc:3.34.0'
        }
    }
}

然后强制设置jdbc版本为支持M1的版本。

这篇关于Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!