LoginSignup
0
0

古いRoomライブラリで「Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64」に遭遇したら

Posted at

上記Udemyでspoonacular APIとRoomを使用したFood Recipeアプリをハンズオンで学んでいた時に、
分かりずらいエラーに出くわしました。

* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
   > 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.

* Get more help at https://help.gradle.org


ビルドエラーをうんうんとうなりながら辿っていくと、以下に到達

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

講座自体がGitHubの更新から見るに3年以上は経っており
M1 MacでのビルドをしようとするとRoomのライブラリで上記エラーになるようです。

room-compilerより前の行に1行追加するだけで解決。
半日悩んだけどあっさり治りました。

 // Room components
kapt "org.xerial:sqlite-jdbc:3.34.0"  // この行を追加
implementation "androidx.room:room-runtime:2.2.5"
kapt "androidx.room:room-compiler:2.2.5"
implementation "androidx.room:room-ktx:2.2.5"
androidTestImplementation "androidx.room:room-testing:2.2.5"

参考

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

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0