2016-03-17 130 views
0

你好我是新來的android工作室和工作在我的項目中添加谷歌分析我從谷歌分析官方網站重申示例項目,演示工作正常,但是當我從我的項目中添加代碼,它說下面的錯誤,在Android Studio中添加谷歌分析時Gradle編譯失敗

錯誤

Error:Execution failed for task ':Stush:processDebugResources'. 
> Error: more than one library with package name 'com.google.android.gms' 
    You can temporarily disable this error with android.enforceUniquePackageName=false 
    However, this is temporary and will be enforced in 1.0 

這是我的gradle.build文件

buildscript { 
    repositories { 
     mavenCentral() 
     jcenter() 
     mavenLocal() 
     maven { 
      name 'maven.aviary.com' 
      url uri("http://maven.aviary.com/repo/release") 
     } 
     maven { url 'https://maven.fabric.io/public' } 

    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.2.3' 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 



apply plugin: 'android' 
apply plugin: 'io.fabric' 



android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     applicationId "com.company.stush" 
     minSdkVersion 14 
     targetSdkVersion 21 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 


repositories { 
    mavenCentral() 
    jcenter() 
    mavenLocal() 
    maven { 
     name 'maven.aviary.com' 
     url uri("http://maven.aviary.com/repo/release") 
    } 
    maven { url 'https://maven.fabric.io/public' } 
} 


dependencies { 
    // compile fileTree(dir: 'libs', include: '*.jar') 
    //compile 'com.android.support:support-v4:23.0.0' 
    compile 'com.soundcloud.android:android-crop:[email protected]' 
    compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.5' 
    compile 'com.facebook.android:facebook-android-sdk:4.1.0' 

    compile files('picasso-2.5.2.jar') 
    compile files('ion-2.1.6.jar') 
    compile files('libs/urlimageviewhelper-1.0.4.jar') 
    // compile files('libs/android-support-v7-appcompat.jar') 
    compile files('androidasync-2.1.6.jar') 
    compile files('libs/http_client/commons-codec-1.6.jar') 
    compile files('libs/http_client/commons-logging-1.1.3.jar') 
    compile files('libs/http_client/fluent-hc-4.3.2.jar') 
    compile files('libs/http_client/httpclient-4.3.2.jar') 
    compile files('libs/http_client/httpclient-cache-4.3.2.jar') 
    compile files('libs/http_client/httpcore-4.3.1.jar') 
    compile files('libs/http_client/httpmime-4.3.2.jar') 
    compile project(':google-play-services_libs') 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 

    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.google.android.gms:play-services:7.3.0' 
    compile 'com.android.support:appcompat-v7:22.0.0' 

} 



android { 
    compileSdkVersion 21 
    buildToolsVersion "20.0.0" 


    lintOptions { 
     checkReleaseBuilds false 
     // Or, if you prefer, you can continue to check for errors in release builds, 
     // but continue the build even when errors are found: 
     abortOnError false 
    } 


    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/dependencies.txt' 
     exclude 'META-INF/LGPL2.1' 
    } 
    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') 
    } 
    dexOptions { 
    } 
} 

請幫我保存我。謝謝大家

回答

0

看看這個錯誤,你已經包含多個庫,其中包含com.google.android.gms包的名稱。也許它的
compile project(':google-play-services_libs')

compile 'com.google.android.gms:play-services:7.3.0'

您應該刪除其中之一。

+0

但是當我刪除編譯'com.google.android.gms:play-services:7.3.0',所有代碼都與谷歌分析有關的錯誤.. :( –

+0

@sulphuricAcid你需要本地的google-玩-services_libs? – tritop