使用 appcompat-v7:28.0.0 将 Firebase Analytics 添加到 Android 项目时出错
Error when adding Firebase Analytics to Android project with appcompat-v7:28.0.0
我有一个正在运行的 Android 项目,我正在尝试添加 Firebase 分析。一旦我将 implementation 'com.google.firebase:firebase-analytics:17.2.1'
添加到我的 graddle,它就会在 post 的末尾给我错误。我尝试了在其他 post 上发现的几个建议,比如在 appcompat 行的末尾添加“-alpha1”,但这是一个兔子洞。我也做了错误提示的事情,但同样是另一个兔子洞。
有人有其他建议吗?
应用插件:'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.track.live"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
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'
implementation 'com.intuit.sdp:sdp-android:1.0.4'
implementation 'com.intuit.ssp:ssp-android:1.0.4'
implementation 'io.realm:realm-android:0.82.1'
implementation 'me.jahirfiquitiva:FABsMenu:1.1.4'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
testImplementation 'junit:junit:4.12'
annotationProcessor 'io.realm:realm-android:0.82.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
}
apply plugin: 'com.google.gms.google-services'
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 element
at AndroidManifest.xml:14:5-52:19 to override.
您在错误消息中有建议 "Suggestion: add 'tools:replace="android:appComponentFactory""
但我的意见和建议 - 移动到 androidX
您正在使用最新版本的 firebase 分析。 Firebase 于 2019 年 6 月从文档迁移到 androidx:
This release is a MAJOR version update and includes breaking changes.
With this release, libraries are migrated from the Android Support Libraries to the Jetpack (AndroidX) Libraries.
The updated libraries will not work unless you make the following changes in your app:
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.
以上内容适用于 17.0.0 版的 firebase 分析。
您可以在此处找到更多信息:
https://firebase.google.com/support/release-notes/android#2019-06-17
我有一个正在运行的 Android 项目,我正在尝试添加 Firebase 分析。一旦我将 implementation 'com.google.firebase:firebase-analytics:17.2.1'
添加到我的 graddle,它就会在 post 的末尾给我错误。我尝试了在其他 post 上发现的几个建议,比如在 appcompat 行的末尾添加“-alpha1”,但这是一个兔子洞。我也做了错误提示的事情,但同样是另一个兔子洞。
有人有其他建议吗?
应用插件:'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.track.live"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
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'
implementation 'com.intuit.sdp:sdp-android:1.0.4'
implementation 'com.intuit.ssp:ssp-android:1.0.4'
implementation 'io.realm:realm-android:0.82.1'
implementation 'me.jahirfiquitiva:FABsMenu:1.1.4'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
testImplementation 'junit:junit:4.12'
annotationProcessor 'io.realm:realm-android:0.82.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
}
apply plugin: 'com.google.gms.google-services'
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 element at AndroidManifest.xml:14:5-52:19 to override.
您在错误消息中有建议 "Suggestion: add 'tools:replace="android:appComponentFactory"" 但我的意见和建议 - 移动到 androidX
您正在使用最新版本的 firebase 分析。 Firebase 于 2019 年 6 月从文档迁移到 androidx:
This release is a MAJOR version update and includes breaking changes.
With this release, libraries are migrated from the Android Support Libraries to the Jetpack (AndroidX) Libraries.
The updated libraries will not work unless you make the following changes in your app:
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.
以上内容适用于 17.0.0 版的 firebase 分析。
您可以在此处找到更多信息:
https://firebase.google.com/support/release-notes/android#2019-06-17