【发布时间】:2016-04-08 10:01:42
【问题描述】:
我正在尝试在我的 App 中实现 Google Analytics,但在编译时出现以下错误:
错误:任务 ':app:mergeDebugResources' 执行失败。 [xml/global_tracker] C:\Users\Carlos\AndroidStudioProjects\Capstone\SP\Stocks 面板 Lite\app\src\main\res\xml\global_tracker.xml [xml/global_tracker] C:\Users\Carlos\AndroidStudioProjects\Capstone\SP\Stocks 面板 Lite\app\build\generated\res\google-services\debug\xml\global_tracker.xml: 错误:重复资源
我尝试运行干净的项目,但我得到了同样的错误。如果我删除 app/build,我也会得到同样的错误。
提前致谢。
更新:build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.carlos.capstone"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:support-annotations:23.1.1'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava:1.1.1'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
compile 'com.bignerdranch.android:expandablerecyclerview:2.0.4'
compile 'com.crazyhitty.chdev.ks:rss-manager:0.21'
compile 'com.github.frankiesardo:linearlistview:1.0.1@aar'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.facebook.stetho:stetho-urlconnection:1.3.1'
compile 'com.facebook.stetho:stetho:1.3.1'
compile 'com.android.support:customtabs:23.0.0+'
compile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
compile 'org.apache.commons:commons-lang3:3.1'
compile 'org.apache.poi:poi:3.14'
compile 'net.sf.supercsv:super-csv:2.4.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
}
【问题讨论】:
-
显示你的
build-gradle -
好的。对于测试用例使用
compile 'com.google.android.gms:play-services:7.3.0'不需要services-analytics:8.3.0 -
如果注释掉
apply plugin: 'com.google.gms.google-services'会出现任何崩溃??您可以设置配置的底线 -
我已经实现了Levon给出的解决方案?要不要我把 global_tracker.xml 再放一遍试试看?
-
当我从 compile 'com.google.android.gms:play-services-gcm:8.3.0' 更改为 7.3.0 时,此错误消失
标签: android android-resources google-analytics-firebase google-play-services