为什么在应用 firebase 和 google 身份验证库时出现清单合并错误
why am i getting Manifest merge error when apply firebase and google authentication libraries
我正在尝试将我的应用程序连接到 firebase 并使用其中的 google 身份验证系统
在应用库时我收到一个明显的合并错误
错误在这一行
implementation 'com.google.firebase:firebase-core:17.0.0'
这是我得到的错误
ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-23:19 to override.
当将版本降级到 16.0.0 时,错误消失了,但是我无法添加任何其他库,例如,如果我想添加
implementation 'com.google.firebase:firebase-auth:18.0.0'
我收到这个错误
ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.
1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-stats:15.0.1 -> com.google.android.gms:play-services-basement@[
15.0.1], but play-services-basement version was 17.0.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-core@{strictly 16.0.0}
-- Project 'app' depends onto com.google.android.gms:play-services-flags@{strictly 17.0.0}
-- Project 'app' depends onto com.google.firebase:firebase-auth@18.0.0
-- Project 'app' depends onto com.google.firebase:firebase-core@16.0.0
-- Project 'app' depends onto com.google.firebase:firebase-analytics-impl@{strictly 16.0.0}
我是 android 的新手,任何建议都很好
这是我的应用程序build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.firebasetestingprojecttwo"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
我目前使用的是以下版本。试试这个,这可能有效。
将 firebase-core 版本降级到 16.0.0
implementation 'com.google.firebase:firebase-core:16.0.0'
并使 firebase-auth 版本为 11.6.0
implementation 'com.google.firebase:firebase-auth:11.6.0'
要么你迁移到 androidX,要么你降级你的 firebase
例如我使用
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.6'`
我正在尝试将我的应用程序连接到 firebase 并使用其中的 google 身份验证系统
在应用库时我收到一个明显的合并错误 错误在这一行
implementation 'com.google.firebase:firebase-core:17.0.0'
这是我得到的错误
ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-23:19 to override.
当将版本降级到 16.0.0 时,错误消失了,但是我无法添加任何其他库,例如,如果我想添加
implementation 'com.google.firebase:firebase-auth:18.0.0'
我收到这个错误
ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.
1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-stats:15.0.1 -> com.google.android.gms:play-services-basement@[
15.0.1], but play-services-basement version was 17.0.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-core@{strictly 16.0.0}
-- Project 'app' depends onto com.google.android.gms:play-services-flags@{strictly 17.0.0}
-- Project 'app' depends onto com.google.firebase:firebase-auth@18.0.0
-- Project 'app' depends onto com.google.firebase:firebase-core@16.0.0
-- Project 'app' depends onto com.google.firebase:firebase-analytics-impl@{strictly 16.0.0}
我是 android 的新手,任何建议都很好
这是我的应用程序build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.firebasetestingprojecttwo"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
我目前使用的是以下版本。试试这个,这可能有效。 将 firebase-core 版本降级到 16.0.0
implementation 'com.google.firebase:firebase-core:16.0.0'
并使 firebase-auth 版本为 11.6.0
implementation 'com.google.firebase:firebase-auth:11.6.0'
要么你迁移到 androidX,要么你降级你的 firebase 例如我使用
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.6'`