java 添加www.example.com后项目无法编译androidx.room:room-compiler:2.1.0-alpha 05

zvms9eto  于 2023-05-12  发布在  Java
关注(0)|答案(4)|浏览(115)

Application gradle文件和Project gradle文件。

错误:找不到符号类DataBindingComponent

dependencies 
    {
        implementation 'androidx.room:room-runtime:2.1.0-alpha05'
        annotationProcessor 'androidx.room:room-compiler:2.1.0-alpha05'
  
    }
-----------------------------------------------------------------------------
    allprojects {
        repositories {
            jcenter()
            maven { url "https://jitpack.io" }
            google()
            maven { url "https://kotlin.bintray.com/kotlinx/" }
        }
    }
du7egjpx

du7egjpx1#

maven { url "https://kotlin.bintray.com/kotlinx/" }添加到项目存储库中。
Room 2.1.0-alpha 05依赖于kotlinx-metadata-jvm构件,该构件目前在Maven Central中不可用
Refer Official doc

biswetbf

biswetbf2#

我解决了将gradle build插件升级到3.3.2的错误:

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.2'
    classpath 'com.google.gms:google-services:4.2.0'
    classpath 'io.fabric.tools:gradle:1.27.1'
}

如果你一直在使用io.fabric插件,这个版本会产生一些警告(参见API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders())。

enxuqcxy

enxuqcxy3#

我也遇到过类似的问题,这是显示的错误:

Searched in the following locations:
  - file:/Users/4leyam/Library/Android/sdk/extras/m2repository/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.pom
  - file:/Users/4leyam/Library/Android/sdk/extras/m2repository/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.jar
  - file:/Users/4leyam/Library/Android/sdk/extras/google/m2repository/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.pom
  - file:/Users/4leyam/Library/Android/sdk/extras/google/m2repository/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.jar
  - file:/Users/4leyam/Library/Android/sdk/extras/android/m2repository/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.pom
  - file:/Users/4leyam/Library/Android/sdk/extras/android/m2repository/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.jar
  - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.pom
  - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.jar
  - https://jcenter.bintray.com/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.pom
  - https://jcenter.bintray.com/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.0.5/kotlinx-metadata-jvm-0.0.5.jar
Required by:
    project :app > androidx.room:room-compiler:2.1.0-alpha05

我找到的临时解决方案是将room_version降级为

def room_version = "2.1.0-alpha04"

请分享是否有更好的解决方案

sxpgvts3

sxpgvts34#

你可以尝试使用“2.4.0-alpha 05”版本的房间,在我的情况下,它总是工作,没有任何bug。至少到现在(2023年)我还不需要改变版本。我没有任何文档链接或类似的东西来确认我的答案,我只是想根据自己的经验来帮助你。值得一试。希望这能帮上忙。

相关问题