android 清单合并失败,gms 播放服务/firebase
android manifest merger failed, gms play services / firebase
我正在尝试使用 firebaseUI 将 firebase 添加到我的应用程序。 As the documentations says, I have used the corresponding gms:play-services (11.0.4) with the firebaseUI version (2.2.0)
当我同步 gradle 个文件时,我收到以下错误:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0) from [com.android.support:support-v13:26.0.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:customtabs:25.4.0] AndroidManifest.xml:25:13-35 value=(25.4.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
这是我的 gradle 文件:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.test.test"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:support-v13:26.0.0'
compile 'com.android.support:design:26.0.0'
compile 'com.android.support:recyclerview-v7:26.0.0'
//firebase
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-storage:11.0.4'
compile 'com.firebaseui:firebase-ui:2.2.0'
testCompile 'junit:junit:4.12'
}
//firebase
apply plugin: 'com.google.gms.google-services'
我已经确保所有版本都是最新的并且它们都是一样的。无法弄清楚问题出在哪里?
在应用程序级别末尾添加此行 gradle 文件
apply plugin: 'com.google.gms.google-services'
我通过添加解决了这个问题:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.0'
}
}
}
}
from here.
工具提示建议将 tools:replace="android:value"' 添加到元数据中,但这会引发另一个错误,所以我将使用上面的解决方案
我可以通过悬停解决
compile 'com.android.support:appcompat-v7:26.0.0'
并手动添加它认为错误的库,例如
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:animated-vector-drawable:26.0.0'
compile 'com.android.support:customtabs:26.0.0'
这是因为 两个版本 的支持库发生冲突。在顶部,您已声明
buildToolsVersion "26.0.1"
并且在依赖项中,版本是 26.0.0
compile 'com.android.support:design:26.0.0'
只需将支持库版本更改为 26.0.1 即可正常工作。我也这样做了,在我的案例中完美无缺。
将此行添加到您的清单中
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"
tools:replace="android:value" />
与 "application" 标签内显示的完全一致。
我通过在最底部的 <application>
标签内的 AndroidManifest.xml
中添加这个来解决它:
<meta-data
tools:node="replace"
android:name="android.support.VERSION"
android:value="26.1.0" // <- The max version you see in the error message. For me it was 26.1.0
/>
然后将这两个属性添加到<manifest ... >
标签中:
xmlns:tools="http://schemas.android.com/tools"
tools:node="replace"
出现此类错误是因为您添加了不同的库。
添加库时,请确保所有库都是同一版本,并且可以完美地相互配合。
在app模块build.gradle中使用同一个库的不同版本实现时出现。您可以通过实施相同版本的库来解决这个问题。
如果问题仍然存在,则在 build.gradle(app module)
末尾添加以下代码
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
我正在尝试使用 firebaseUI 将 firebase 添加到我的应用程序。 As the documentations says, I have used the corresponding gms:play-services (11.0.4) with the firebaseUI version (2.2.0) 当我同步 gradle 个文件时,我收到以下错误:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0) from [com.android.support:support-v13:26.0.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:customtabs:25.4.0] AndroidManifest.xml:25:13-35 value=(25.4.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
这是我的 gradle 文件:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.test.test"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:support-v13:26.0.0'
compile 'com.android.support:design:26.0.0'
compile 'com.android.support:recyclerview-v7:26.0.0'
//firebase
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-storage:11.0.4'
compile 'com.firebaseui:firebase-ui:2.2.0'
testCompile 'junit:junit:4.12'
}
//firebase
apply plugin: 'com.google.gms.google-services'
我已经确保所有版本都是最新的并且它们都是一样的。无法弄清楚问题出在哪里?
在应用程序级别末尾添加此行 gradle 文件
apply plugin: 'com.google.gms.google-services'
我通过添加解决了这个问题:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.0'
}
}
}
}
from here.
工具提示建议将 tools:replace="android:value"' 添加到元数据中,但这会引发另一个错误,所以我将使用上面的解决方案
我可以通过悬停解决
compile 'com.android.support:appcompat-v7:26.0.0'
并手动添加它认为错误的库,例如
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:animated-vector-drawable:26.0.0'
compile 'com.android.support:customtabs:26.0.0'
这是因为 两个版本 的支持库发生冲突。在顶部,您已声明
buildToolsVersion "26.0.1"
并且在依赖项中,版本是 26.0.0
compile 'com.android.support:design:26.0.0'
只需将支持库版本更改为 26.0.1 即可正常工作。我也这样做了,在我的案例中完美无缺。
将此行添加到您的清单中
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"
tools:replace="android:value" />
与 "application" 标签内显示的完全一致。
我通过在最底部的 <application>
标签内的 AndroidManifest.xml
中添加这个来解决它:
<meta-data
tools:node="replace"
android:name="android.support.VERSION"
android:value="26.1.0" // <- The max version you see in the error message. For me it was 26.1.0
/>
然后将这两个属性添加到<manifest ... >
标签中:
xmlns:tools="http://schemas.android.com/tools"
tools:node="replace"
出现此类错误是因为您添加了不同的库。 添加库时,请确保所有库都是同一版本,并且可以完美地相互配合。
在app模块build.gradle中使用同一个库的不同版本实现时出现。您可以通过实施相同版本的库来解决这个问题。
如果问题仍然存在,则在 build.gradle(app module)
末尾添加以下代码configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}