Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.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构建失败_Android_Android Gradle Plugin_Build.gradle - Fatal编程技术网

Android:Gradle构建失败

Android:Gradle构建失败,android,android-gradle-plugin,build.gradle,Android,Android Gradle Plugin,Build.gradle,更新android studio后,我尝试运行一个项目,但它显示了一个错误,因为存在一些依赖项错误,表示与依赖项“com.android.support:support annotations”存在冲突 这是我的build.gradle文件 apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion '24.0.3' defaultConfig { applicatio

更新android studio后,我尝试运行一个项目,但它显示了一个错误,因为存在一些依赖项错误,表示与依赖项“com.android.support:support annotations”存在冲突

这是我的build.gradle文件

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
defaultConfig {
    applicationId "com.example.abdelnacer.parentooandroid"
    minSdkVersion 21
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}
}


repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots"     } 
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'
compile 'com.parse:parseui-widget-android:0.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
testCompile 'org.mockito:mockito-core:1.+'
testCompile 'org.robolectric:robolectric:3.2-SNAPSHOT'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
androidTestCompile 'com.android.support:support-annotations:24.2.1'
compile 'com.google.guava:guava:19.0'
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.wefika:flowlayout:0.4.1'
compile 'com.facebook.shimmer:shimmer:0.1.0@aar'
compile 'com.github.armcha:LuseenBottomNavigation:1.8.2'
}
错误呢

Information:Gradle tasks [:app:generateDebugSources,    :app:generateDebugAndroidTestSources, :app:mockableAndroidJar,  :app:prepareDebugUnitTestDependencies]
Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (25.0.0) and test app (24.2.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Error:Execution failed for task ':app:prepareDebugAndroidTestDependencies'.
> Dependency Error. See console for details.
我真的想不出问题出在哪里?

添加:

 androidTestCompile "com.android.support:support-annotations:25.0.0"

也许你的一个库,使用这个依赖项。只需安装API25并更新SDK管理器中的所有内容

如果您查看错误,它会显示:“请参阅以获取详细信息”。如果您访问错误中提到的页面,您会得到问题的解释。而且,如果您在主要搜索引擎上搜索
com.android.support:support annotations conflict
,您会找到答案。您的一个库正在导入25.0.0版的注释。运行
/gradlew dependencies
查看依赖关系树中的哪一个op正在对所有其他支持库使用v24.2.1。否-查看他的stacktrace-一个库在25.0.0中被pullig-因此他得到:应用程序(25.0.0)和测试应用程序(24.2.1)的解析版本不同。所有支持库应使用相同的版本。
compile'com.android.support:appcompat-v7:24.2.1'
all
com.android.support
库应使用相同的版本。如果您更改为25.0.0,您应该更改所有
com.android.support
库的版本。@njzk2我没有更改com.android.support库的版本,现在可以使用了,危险吗?@abdenaceurlicheb。这些库之间可能存在一些不兼容之处,因为它们都相互依赖。