gpt4 book ai didi

Android Room + Kotlin + Kapt + IntelliJ + MacOS Catalina : java. lang.UnsatisfiedLinkError : org. sqlite.core.NativeDB._open_utf8

转载 作者:行者123 更新时间:2023-12-02 13:28:27 37 4
gpt4 key购买 nike

在 MacOS Catalina 上使用带有 Kapt 的 Android Room,我在构建项目时遇到以下错误。如果我从我的 build.gradle 中删除 kapt "androidx.room:room-compiler:$room_version",项目将成功构建。

Failed to load native library:sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib. osinfo: Mac/x86_64
java.lang.UnsatisfiedLinkError: $TMPDIR/sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib: dlopen($TMPDIR/sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib, 1): no suitable image found. Did find:
$TMPDIR/sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib: code signature in ($TMPDIR/sqlite-3.25.2-60e239c7-424b-4b75-bfd5-b2df4aa8e01a-libsqlitejdbc.jnilib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
Failed to load native library:sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib. osinfo: Mac/x86_64
java.lang.UnsatisfiedLinkError: $TMPDIR/sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib: dlopen($TMPDIR/sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib, 1): no suitable image found. Did find:
$TMPDIR/sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib: code signature in ($TMPDIR/sqlite-3.25.2-79b61bc4-bdd0-4451-a523-5baa49728398-libsqlitejdbc.jnilib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

产生以下异常

Caused by: java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V
at org.sqlite.core.NativeDB._open_utf8(Native Method)
at org.sqlite.core.NativeDB._open(NativeDB.java:78)
at org.sqlite.core.DB.open(DB.java:195)
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:243)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)
at org.sqlite.JDBC.createConnection(JDBC.java:116)
at androidx.room.verifier.DatabaseVerifier$Companion.create(DatabaseVerifier.kt:104)
at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:82)
at androidx.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:57)
at androidx.room.RoomProcessor$DatabaseProcessingStep.process(RoomProcessor.kt:134)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:147)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:985)
... 39 more

看起来这和https://github.com/xerial/sqlite-jdbc/issues/97不一样,这是我能找到任何相关信息的唯一问题。有什么办法可以解决这个问题?

编辑:

我最终找到了 this blog post ,这让我找到了 this JDK issue .我验证了 ./gradlew :app:kaptDebugKotlin 与我的 JDK11 一起工作,并更新了 IDEA 以在运行时使用该 JDK,并告诉它使用 gradle 而不是 IDEA 执行构建。这些似乎都没有解决问题 - 在我的终端中使用 JDK11 成功运行 ./gradlew clean :app:kaptDebugKotlin,但通过 IDEA 运行该 gradle 任务失败。

我最终通过从我的运行配置中删除 gradle-aware make 并运行 ./gradlew :app:assembleDebug 来解决这个问题应用程序。这有点烦人,而且增加了一个额外的步骤,但我仍然可以运行/更新应用程序。

最佳答案

弄清楚了 - 结果是 Java SDKGradle 设置在 Android 项目中被忽略,取而代之的是 Java SDK Android SDK 用于 gradle 任务。将 Android SDKJava SDK 设置为 JDK11 可解决此问题,因为该 JDK 具有 JDK-8223671 的修复程序

关于Android Room + Kotlin + Kapt + IntelliJ + MacOS Catalina : java. lang.UnsatisfiedLinkError : org. sqlite.core.NativeDB._open_utf8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62962951/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com