- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试在我的 App 中实现 Google Analytics,但在编译时出现以下错误:
Error:Execution failed for task ':app:mergeDebugResources'. [xml/global_tracker] C:\Users\Carlos\AndroidStudioProjects\Capstone\SP\Stocks Panel Lite\app\src\main\res\xml\global_tracker.xml [xml/global_tracker] C:\Users\Carlos\AndroidStudioProjects\Capstone\SP\Stocks Panel Lite\app\build\generated\res\google-services\debug\xml\global_tracker.xml: Error: Duplicate resources
我尝试运行干净的项目,但我遇到了同样的错误。如果我删除 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'
}
最佳答案
当您在资源 xml 文件夹中放置一个 global_tracker.xml
并且除此之外添加 apply plugin: 'com.google.gms.google-services'
时会发生这种情况> 在你的 build.gradle
文件中。那就是将实现跟踪器的旧方法与新的做事方式混合起来。解决方案是简单地从您的 xml 文件夹中删除 global_tracker.xml
,因为 google-services 插件会自动从 google-services.json
添加所有必需的数据构建应用程序时的配置文件。
此外,建议将 apply plugin: 'com.google.gms.google-services'
行放在 build.gradle
底部的依赖项之后部分。这很奇怪,但是将它放在顶部会导致某些配置出错。
此外,您可能会在尝试构建项目时看到错误:无法找到符号变量 global_tracker,尤其是在您转换旧项目并下载 google-services.json 时
来自您的 Firebase 控制台,同时仍将其与旧版 Google Analytics 一起使用。在这种情况下,打开新添加的 google-services.json
并在“services”对象中找到“analytics_service”。您将需要添加以下内容:
"analytics_property": {
"tracking_id": "<your tracking id>"
所以整个部分看起来像这样(将您自己的 UA-XXXXXXXX-X 跟踪 ID 放在那里):
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": "UA-12345678-9"
}
},
之后,确保在重建之前清理您的项目并重新同步 Gradle。希望对您有所帮助。
关于android - 添加 Google Analytics 时如何修复错误 : Duplicate resources for global_tracker. xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36496785/
我有一个内部表,里面有 108 个条目。从 9 到 9 个条目重复条目,我想删除这些重复项。由于它们完全相同,我使用了 delete adjacent duplicates from itab com
在 Team Foundation Server (TFS) 中链接两个工作项 (WI) 时,在什么情况下将“Duplicate”和“Duplicate Of”区分为“链接类型”是有意义的? 如何处理
ld: duplicate symbol _velocityX in \ /Users/Student/Library/Developer/Xcode/DerivedData/finalproject
我使用 PHP 和 Mysql。 此 SQL 有效: INSERT INTO products (id, title, description) VALUES (10, 'va
我有一个大数据框 (120000x40),我尝试在每一行中找到重复项并显示它们。这就是我的尝试: 创建数据框 import pandas as pd df = pd.DataFrame({'col1'
我是 mySQL 和 PHP 的新手,请多多包涵。 如果我的查询有重复字段,我该如何做到这一点,检索到的数据将具有重复查询字段的重复数据。 一个例子是这样的: 查询 id = 34, 54, 21,
我一直遇到这个错误,但我无法理解它,因为它提示一个值恰好出现一次。 Exception in thread "main" java.lang.IllegalStateException: Duplic
我有一个带有 Vuejs 和 Laravel 的 Web 应用程序 我想使用 CKEditor 5 我安装了依赖项 npm install --save @ckeditor/ckeditor5-vue
我有一个包含以下数据的 csv 文件: Id,Name,Type,date 1,name1,employee,25/04/2017 2,name2,contrator,26/04/2017 3,nam
import CKEditor from '@ckeditor/ckeditor5-react'; import ClassicEditor from '@ckeditor/ckeditor5-bui
表定义: CREATE TABLE PositionalDataNGS ( Date DATE, Time TIME(3) , X FLOAT(5), Y FLOAT(5), D FLOAT(5) ,
我目前正在做一个项目,我要处理数以千计的数据包。现在,我记录每个数据包的 IP 和 MAC 地址以及一些其他信息。为了存储所有这些,我使用 MySQL 并且我的脚本是用 Node.js 编写的。目前我
I am using MySQL 5.1.56, MyISAM. My table looks like this:我使用的是MySQL 5.1.56,MyISAM。我的桌子是这样的: CR
我是新来的,对 SQL 比较陌生。我有一个类似这样的表: [Pk], [Case_No], [Status], [Open_Date], [Close_Date], [Case_Age], [Repo
为什么会收到此警告? warning No duplicate props allowed react/jsx-no-duplicate-props# 它显示的是第28行,但没有使用 Prop 。 最
是否有任何函数或方法可以在 python 2.7 中递归实现此目的? Input : ['and', ['or', 'P', '-R', 'P'], ['or', '-Q', '-R', 'P']]
我正在分析 hadoop 中的数据。有一些重复条目,其中 A、B 列重复,而 C 列不同。我想要做的是仅识别 A、B 重复项,然后为每个重复项打印出 C 列的不同值。 示例数据: row, data
您好,感谢阅读并可能对我有所帮助 我的问题的简要说明: 我正在将数据从一个 Firebird 数据库复制到另一个(称为 V14),并且我正在使用 IBExpert 来执行此操作。这些表的名称相同并且具
我想制作一张很像下面的图片: 我想使用 seaborn 使图表看起来漂亮,并让我自己以后更容易使用 facetgrids(我有十个不同的数据集,我想在同一个图表中显示。) 我在 seaborn 中找到
我在两列“user_id”和“project_id”上有一个复合唯一键。 当我尝试对单行或多行运行 DELETE 查询时,出现错误。 ERROR 1062: 1062: Duplicate entry
我是一名优秀的程序员,十分优秀!