3

During a build of my Android project on my M1 Apple Silicon using kapt (eg Room)

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

With

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

I run into

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.

I've no clue how to make it work with fast aarch64 !

With x86 it works

Android Studio Arctic Fox | 2020.3.1 Beta 1 x86
hannes ach
  • 16,247
  • 7
  • 61
  • 84
  • Are you using Room database ? – Karunesh Palekar Jul 07 '21 at 11:08
  • Yes, I run into this using Room and Dagger. And I ask myself why I use this error prone and lifetime consuming Dagger – hannes ach Jul 07 '21 at 11:33
  • Yeah , switch to hilt . It's way better . I have faced this issue many times and much of the times the issue is with the Room Dao or the entity or the annotation used in a wild way .And also , just a out of the way question . Does AS works good on M1 ? I am planning to buy one , but lack of supports makes me to back out . – Karunesh Palekar Jul 07 '21 at 11:57
  • Hilt that's new to me. Is it "better" then Koin ? Anyway, M1 works almost perfect, here you can read https://stackoverflow.com/questions/64907154/android-studio-emulator-on-macos-with-arm-cpu-m1/65176867#65176867 – hannes ach Jul 07 '21 at 12:37
  • 1
    Hilt is built by android team on top of dagger and it's awesome .It is easy to test as well .Also if you use ViewModel's then there is a dedicated way to inject dependencies ,so you don't have to perform the workaround . Should give a try .And thanks for the m1 reference . – Karunesh Palekar Jul 07 '21 at 14:00
  • My success comes too early, I changed my answer – hannes ach Jul 07 '21 at 22:02

1 Answers1

14

The root cause was Room 2.3.0 This https://github.com/xerial/sqlite-jdbc/issues/450 pointed me to the solution

Solution A

add

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

it includes this https://github.com/xerial/sqlite-jdbc/releases/tag/3.32.3.3

Solution B

Simply use Room 2.4.0-alpha03

hannes ach
  • 16,247
  • 7
  • 61
  • 84