Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
升级到最新的Android Gradle插件AndoidX后出现Gradle错误_Android_Android Studio_Guava_Androidx - Fatal编程技术网

升级到最新的Android Gradle插件AndoidX后出现Gradle错误

升级到最新的Android Gradle插件AndoidX后出现Gradle错误,android,android-studio,guava,androidx,Android,Android Studio,Guava,Androidx,升级到最新的AndroidX libs&Android Gradle插件后,当我在项目上运行lint时,lint构建失败 这一切都是从最新的Android Gradle插件开始的,该插件抱怨程序类型已经存在:com.google.common.util.concurrent.ListenableFuture在构建我的项目时 以下是错误: FAILURE: Build failed with an exception. * What went wrong: Execution failed fo

升级到最新的AndroidX libs&Android Gradle插件后,当我在项目上运行lint时,lint构建失败

这一切都是从最新的Android Gradle插件开始的,该插件抱怨程序类型已经存在:com.google.common.util.concurrent.ListenableFuture在构建我的项目时

以下是错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lint'.
> Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not resolve com.google.guava:guava:23.6-android.
     Required by:
         project :app
      > Cannot find a version of 'com.google.guava:guava' that satisfies the version constraints: 
           Dependency path 'Code Base:app:unspecified' --> 'androidx.test.ext:truth:1.1.0' --> 'com.google.guava:guava:26.0-android'
           Dependency path 'Code Base:app:unspecified' --> 'com.google.truth:truth:0.42' --> 'com.google.guava:guava:25.1-android'
           Dependency path 'Code Base:app:unspecified' --> 'androidx.room:room-guava:2.1.0-alpha03' --> 'com.google.guava:guava:23.6-android'
           Dependency path 'Code Base:app:unspecified' --> 'com.google.api-client:google-api-client:1.25.0' --> 'com.google.guava:guava:20.0'
           Dependency path 'Code Base:app:unspecified' --> 'androidx.test.ext:truth:1.1.0' --> 'com.google.truth:truth:0.42' --> 'com.google.guava:guava:25.1-android'
           Constraint path 'Code Base:app:unspecified' --> 'com.google.guava:guava' strictly '23.6-android' because of the following reason: debugRuntimeClasspath uses version 23.6-android
           Constraint path 'Code Base:app:unspecified' --> 'com.google.guava:guava' strictly '23.6-android' because of the following reason: debugRuntimeClasspath uses version 23.6-android
           Constraint path 'Code Base:app:unspecified' --> 'com.google.guava:guava' strictly '23.6-android' because of the following reason: debugRuntimeClasspath uses version 23.6-android
           Constraint path 'Code Base:app:unspecified' --> 'com.google.guava:guava' strictly '23.6-android' because of the following reason: debugRuntimeClasspath uses version 23.6-android

   > Could not resolve org.checkerframework:checker-compat-qual:2.0.0.
     Required by:
         project :app
      > Cannot find a version of 'org.checkerframework:checker-compat-qual' that satisfies the version constraints: 
           Dependency path 'Code Base:app:unspecified' --> 'com.google.truth:truth:0.42' --> 'org.checkerframework:checker-compat-qual:2.5.3'
           Dependency path 'Code Base:app:unspecified' --> 'androidx.test.ext:truth:1.1.0' --> 'com.google.guava:guava:26.0-android' --> 'org.checkerframework:checker-compat-qual:2.5.2'
           Dependency path 'Code Base:app:unspecified' --> 'androidx.test.ext:truth:1.1.0' --> 'com.google.truth:truth:0.42' --> 'org.checkerframework:checker-compat-qual:2.5.3'
           Constraint path 'Code Base:app:unspecified' --> 'org.checkerframework:checker-compat-qual' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
           Constraint path 'Code Base:app:unspecified' --> 'org.checkerframework:checker-compat-qual' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
           Constraint path 'Code Base:app:unspecified' --> 'org.checkerframework:checker-compat-qual' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
           Constraint path 'Code Base:app:unspecified' --> 'org.checkerframework:checker-compat-qual' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0

   > Could not resolve com.google.errorprone:error_prone_annotations:2.1.3.
     Required by:
         project :app
我试着放了以下内容,但不起作用:

subprojects {
    project.configurations.all {

        exclude group: 'com.google.guava', module: 'failureaccess'


        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }

            if('guava' == details.requested.name) {
                details.useVersion '27.0-android'
            }

        }
    }
}
我可以知道这些错误是什么意思吗?我怎样才能解决它? 谢谢。

换衣服

details.useVersion '27.0-android'


由于错误消息
无法解析com.google.guava:guava:23.6-android。
告诉它需要版本
23.6-android

我也试图解决这个问题,对我来说,这是由于新的google places库:

implementation“com.google.android.libraries.places:places:1.0.0”

这导致
androidTest
下的测试失败

作为解决方法,我将此添加到
build.gradle

configurations {
    androidTestImplementation.exclude module: 'guava'
    androidTestImplementation.exclude module: 'error_prone_annotations'
    androidTestImplementation.exclude module: 'checker-qual'
}
它修复了lint和Android测试。不过,目前还不确定后果如何


编辑:在您的情况下,您可能需要放置
检查程序compat qual
,而不是
检查程序qual

检查变体是否具有重复的依赖项。例如:

implementation 'com.google.truth:truth:0.42' 
...
androidTestImplementation 'com.google.truth:truth:0.42' 

将此应用程序模块中的Build.gradle上

lintOptions {
    checkReleaseBuilds false
    abortOnError false
}

如果与当前帖子无关,请关闭当前问题并针对新错误发布单独的问题。我会去新的线程看看。谢谢,谢谢你的回复。我已尝试并创建了另一组新错误:出错原因:无法确定任务“:app:lint”的依赖项。“>无法解析配置“”的所有任务依赖项:应用程序:releaseRuntimeClasspath。“>无法解析com.google.firebase:firebase iid:[17.0.4]。由…>无法解析com.google.android.gms:play services度量基准:[16.3.0]。所需人员:project:app>com.google.firebase:firebase core:16.0.7>**如何解决上述错误**看到这个关于更新的帖子:在我清除缓存、清理项目并再次运行上面的答案(即更改为23.6-android)后,我得到了原始错误,仍然说。。。无法解析com.google.guava:guava:23.6-android.Hi limdale,感谢您的大力帮助。您的解决方案对我解决android测试错误很有效。对于那些遇到与我相同错误的人…最终我将其放入build.gradle配置中{androidTestImplementation.exclude模块:'guava'androidTestImplementation.exclude模块:'error\u-provide\u-annotations'androidTestImplementation.exclude模块:'checker compat qual'all*。exclude组:'com.google.guava',模块:'listenablefuture'}这本身并不是一个lint错误。lint只是试图编译您的所有模块和测试,您在Guava上遇到了依赖冲突。我更新了您的一些原始问题。这不是lint问题,而是依赖冲突
lintOptions {
    checkReleaseBuilds false
    abortOnError false
}