Gradle编译错误

1. Error:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (22.0.0) differ

解决方法:在项目的build.gradle中加入

configurations.all{
    resolutionStrategy.force 'com.android.support:support-annotations:23.3.0'
}

其实类型的依赖冲突,可以使用类似的方法,强制使用一个版本


2. Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/NOTICE.txt

解决方法:在项目的build.gradle中加入

    packagingOptions {

...
        exclude 'META-INF/NOTICE.txt'

...
    }


你可能感兴趣的:(android)