【发布时间】:2018-09-22 12:48:34
【问题描述】:
我收到此错误:
Permission name C2D_MESSAGE is not unique (appears in both my.packagename.permission.C2D_MESSAGE and my.packagename.acc.permission.C2D_MESSAGE) (Previous permission here)
在我的 Android 清单中:
<permission
android:name="my.packagename.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="my.packagename.permission.C2D_MESSAGE" />
问题是在将 applicationIdSuffix 添加到 build.gradle 中的一个风味之后开始的(乍一看似乎与它无关)。
Build.gradle:
flavorDimensions "type"
productFlavors {
acceptance {
dimension="type"
applicationIdSuffix ".acc"
versionNameSuffix "-acc"
}
production {
dimension="type"
applicationIdSuffix ""
versionNameSuffix ""
}
}
Application.java:
if (BuildConfig.DEBUG) {
GoogleAnalytics.getInstance(context).setDryRun(true);
} else {
setupGoogleAnalytics();
}
我创建了 google-services.json 的副本。
我已将 google-services.json 添加到:
app\src\acceptance\google-services.json (fake numbers)
app\src\production\google-services.json
我为接受中的键设置了不同的虚假值。我不希望接受版本中的 Google Analytics。所以我宁愿不创建单独的 google-services.json。这可能吗?
Simply removing manifest 中的权限 不适用于 API
【问题讨论】:
-
你检查过this SO post中的建议答案了吗?
-
是的,我已经检查过了,它不适用于 API
标签: android google-play-services