Error:Internal error:
org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.10.1-all.zip'.
.......
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getSelectedArtifacts(DefaultConfiguration.java:1037)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:1025)
... 43 more
Caused by: org.gradle.api.GradleException: Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints:
Dependency path 'xxx:app:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
Dependency path 'xxx:app:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
Dependency path 'xxx:app:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
Dependency path 'xxx:app:unspecified' --> 'com.android.support.test.espresso:espresso-core:3.0.2' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
Dependency path 'xxx:app:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-vector-drawable:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
Dependency path 'xxx:app:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
Dependency path 'xxx:app:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-media-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
Dependency path 'xxx:app:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-utils:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
Dependency path 'xxx:app:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-ui:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
Dependency path 'xxxx:app:unspecified' --> 'xxx:loginmanager:unspecified' --> 'com.yanzhenjie:permission:1.0.7' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
Constraint path 'xxx:app:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
Constraint path 'xxx:app:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
Constraint path 'xxx:app:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
Constraint path 'xxx:app:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.validateGraph(DependencyGraphBuilder.java:322)
... 59 more
将Gradle版本从3.0.0修改成3.3.2之后,重新编译,出错.
从错误信息中我们可以推测出是support-annotations这个包重复了,有27.1.1的依赖和26.1.0的依赖,所以修改其中一个,让其保持一致,
或者将使用27.1.1的依赖关系去掉,将下面的引用注释掉:
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
编译OK