Android studio 工程 Mac M1芯片适配总结

603 阅读1分钟
  1. M1芯片Mac 下载studio的时候选择后缀带arm的安装包

2. 配置对应版本jdk Androidstudio setting里修改 jdk版本。

图片3.png

3.如果有用 Protobuf 修改: protoc {artifact = 'com.google.protobuf:protoc:3.5.1' }为

protoc {artifact = 'com.google.protobuf:protoc:3.5.1:osx-x86_64'}

4.数据库适配。 以Room为例

原:

  


    implementation "androidx.room:room-runtime:$rootProject.roomVersion"

    annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion"

androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"

修改为:


    implementation ("androidx.room:room-runtime:$rootProject.roomVersion"){

        exclude(group:'org.xerial')

    }

    annotationProcessor ("androidx.room:room-compiler:$rootProject.roomVersion"){

        exclude(group:'org.xerial')

    }

    androidTestImplementation ("androidx.room:room-testing:$rootProject.roomVersion"){

        exclude(group:'org.xerial')

}

annotationProcessor ('org.xerial:sqlite-jdbc:3.34.0')