实施 'com.google.firebase:firebase-core:17.0.0' 并应用插件后出现错误:'com.google.gms.google-services'
Getting error after implement 'com.google.firebase:firebase-core:17.0.0' and apply plugin: 'com.google.gms.google-services'
在我的应用 build.gradle
文件
中添加 implementation 'com.google.firebase:firebase-core:17.0.0'
和 apply plugin: 'com.google.gms.google-services'
后尝试构建我的应用时出现错误
我使用了行 com.android.tools.build:gradle:3.4.0
和 compileSdkVersion = 28
我将这些行放在我的项目 build.gradle
文件中。在我放置这些行之前,我能够构建项目
我得到的错误信息:
`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 element at AndroidManifest.xml:13:5-354:19 to override.
经过一番研究,我得到了这个。
我更新了我的应用程序以使用 Jetpack (AndroidX),我通过添加这两行来做到这一点:android.useAndroidX=true
和 android.enableJetifier=true
到项目根目录中的文件 gradle.properties
在我的应用 build.gradle
文件
implementation 'com.google.firebase:firebase-core:17.0.0'
和 apply plugin: 'com.google.gms.google-services'
后尝试构建我的应用时出现错误
我使用了行 com.android.tools.build:gradle:3.4.0
和 compileSdkVersion = 28
我将这些行放在我的项目 build.gradle
文件中。在我放置这些行之前,我能够构建项目
我得到的错误信息:
`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 element at AndroidManifest.xml:13:5-354:19 to override.
经过一番研究,我得到了这个。
我更新了我的应用程序以使用 Jetpack (AndroidX),我通过添加这两行来做到这一点:android.useAndroidX=true
和 android.enableJetifier=true
到项目根目录中的文件 gradle.properties