【问题标题】:InvocationTargetException with Android Arctic Fox | 2020.3.1 arm64 on M1 Apple siliconAndroid 北极狐的 InvocationTargetException | M1 Apple 硅片上的 2020.3.1 arm64
【发布时间】:2021-09-17 20:17:25
【问题描述】:

在使用kapt(例如 Room)在我的 M1 Apple Silicon 上构建我的 Android 项目期间

Android Studio Arctic Fox | 2020.3.1 Beta 1 arm64
..
Android Studio Arctic Fox | 2020.3.1 Beta 5 arm64
Android Studio Bumblebee | 2021.1.1 Canary 2 aarch64

Android Studio Arctic Fox | 2020.3.1 Beta 5
Build #AI-203.7717.56.2031.7360992, built on May 14, 2021
Runtime version: 11.0.10+0-b96-7249189 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.4

我遇到了

Execution failed for task ':FFTSpectrumLib:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
   > java.lang.reflect.InvocationTargetException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

我不知道如何使它与快速 aarch64 一起工作!

使用 x86 可以工作

Android Studio Arctic Fox | 2020.3.1 Beta 1 x86

【问题讨论】:

  • 你在使用 Room 数据库吗?
  • 是的,我使用 Room 和 Dagger 遇到了这个问题。我问自己为什么要使用这种容易出错且耗时的 Dagger
  • 是的,切换到刀柄。好多了我已经多次遇到这个问题,而且很多时候问题都与 Room Dao 或实体或以狂野方式使用的注释有关。而且,只是一个偏僻的问题。 AS 在 M1 上效果好吗?我打算买一个,但缺乏支持让我退出。
  • 刀柄对我来说是新的。它比 Koin“更好”吗?不管怎样,M1 几乎可以完美运行,这里你可以阅读stackoverflow.com/questions/64907154/…
  • Hilt 是由 android 团队在 dagger 之上构建的,非常棒。它也很容易测试。另外,如果你使用 ViewModel,那么有一个专用的方法来注入依赖项,所以你不需要必须执行解决方法。应该试一试。感谢 m1 的参考。

标签: android arm64 apple-m1 apple-silicon kapt


【解决方案1】:

根本原因是房间2.3.0 这个https://github.com/xerial/sqlite-jdbc/issues/450 为我指出了解决方案

解决方案 A

添加

kapt "org.xerial:sqlite-jdbc:3.34.0"

它包括这个https://github.com/xerial/sqlite-jdbc/releases/tag/3.32.3.3

解决方案 B

只需使用房间2.4.0-alpha03

【讨论】:

  • 我非常爱你!
猜你喜欢
  • 1970-01-01
  • 2021-10-20
  • 2021-10-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多