Execution failed for task ‘:app:kaptDebugKotlin‘.

文章描述了在M1芯片的Mac电脑上,新工程项目遇到Room与SQLite-JDBC不兼容的问题,导致编译错误。解决方案包括修改依赖排除特定库,或者使用JDK的x86/x64版本和Rosetta。目前有一个未发布的pullrequest在GitHub上支持AppleSilicon,期待在后续版本中得到解决。
摘要由CSDN通过智能技术生成

我的场景:

1.Mac电脑,M1芯片
2.新工程项目,没有任何改动

报错:

在这里插入图片描述

解决办法

在Google的IssueTracker里找到的
总结:room没有适配M1,需要对room的引用进行修改

kapt("org.xerial:sqlite-jdbc:3.34.0") //追加这条
kapt("androidx.room:room-compiler:2.3.0-beta01")

或者

 def room_version = "2.3.0-alpha03"
    implementation("androidx.room:room-runtime:$room_version") {
        exclude(group:'org.xerial')
    }
    kapt("androidx.room:room-compiler:$room_version"){
        exclude(group:'org.xerial')
    }
    implementation("androidx.room:room-ktx:$room_version"){
        exclude(group:'org.xerial')
    }
    implementation 'org.xerial:sqlite-jdbc:3.34.0'

原因:

大佬的回复:

大佬A:
Room uses https://github.com/xerial/sqlite-jdbc a JDBC library for SQLite, can you please file a bug in https://github.com/xerial/sqlite-jdbc asking to support the aarch64 architecture in the new Mac + M1 Chip?

I don’t have a M1 machine to try this out but my guess is they simply don’t have yet a compiled SQLite native lib for the aarch64.

大佬A:
By the way, I imagine you can workaround this using a JDK x86/x64 version + Rosetta that would make the JNI layer load the right native library.

大佬B:
Yes, Apple Silicon is supported by this pull request https://github.com/xerial/sqlite-jdbc/pull/558, but not released yet.

Hope to be supported in the next version of Room. Thanks!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值