如何使用软件包名称修复多个库' com.google.android.gms'?

时间:2017-02-18 00:40:08

标签: android android-gradle

我对这个错误感到很累,但我无法修复它。

Error:Execution failed for task ':app:processDebugResources'.
  

错误:多个包含包名称的库' com.google.android.gms'

的build.gradle:

apply plugin: 'android-library'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':google-play-services_lib')
}

android {
    compileSdkVersion 10
    buildToolsVersion "25.0.2"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

非常感谢。

1 个答案:

答案 0 :(得分:0)

您正在编译google play service library,但是在您的gradle文件中,有一些库依赖于此lib。因此,您错误多个包含的库。首先,如果您不需要编译google play service library,请检查lib包含compile project(':google-play-services_lib')的libs目录。我认为您可以按照https://developers.google.com/android/guides/setup设置Google Play服务的最佳方式。