简体   繁体   English

使用 appcompat-v7:28.0.0 将 Firebase Analytics 添加到 Android 项目时出错

[英]Error when adding Firebase Analytics to Android project with appcompat-v7:28.0.0

I have a working Android project that i am trying to add Firebase analytics.我有一个正在运行的 Android 项目,我正在尝试添加 Firebase 分析。 As soon as i add implementation 'com.google.firebase:firebase-analytics:17.2.1' to my graddle it gives me the error at the end of the post.一旦我将implementation 'com.google.firebase:firebase-analytics:17.2.1'添加到我的 gradle 中,它就会在帖子末尾给出错误。 I tried several suggestins i found on other post like adding "-alpha1" at the end of appcompat line but it was a rabit hole.我尝试了在其他帖子中发现的几个建议,例如在 appcompat 行的末尾添加“-alpha1”,但这是一个兔子洞。 I also did what the error suggests but the same another rabbit hole.我也做了错误提示的事情,但同样是另一个兔子洞。 Does any one have any other suggestions?有人有其他建议吗? apply plugin: 'com.android.application'应用插件:'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).错误:清单合并失败:来自 [com.android.support:support-compat:28.0.0] 的属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) AndroidManifest.xml:22:18-91 也是出现在 [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.建议:在 AndroidManifest.xml:14:5-52:19 处的元素中添加 'tools:replace="android:appComponentFactory"' 以覆盖。

You are using the latest version of firebase analytics.您正在使用最新版本的 firebase 分析。 Firebase migrated to androidx in June 2019, from the docs: 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.在此版本中,库从 Android 支持库迁移到 Jetpack (AndroidX) 库。

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.将 com.android.tools.build:gradle 升级到 v3.2.1 或更高版本。

Upgrade compileSdkVersion to 28 or later.将 compileSdkVersion 升级到 28 或更高版本。

Update your app to use Jetpack (AndroidX);更新您的应用以使用 Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.按照迁移到 AndroidX 中的说明进行操作。

The above is applied from version 17.0.0 of firebase analytics.以上内容适用于 17.0.0 版的 firebase 分析。

You can find more info here:您可以在此处找到更多信息:

https://firebase.google.com/support/release-notes/android#2019-06-17 https://firebase.google.com/support/release-notes/android#2019-06-17

https://developer.android.com/jetpack/androidx/migrate https://developer.android.com/jetpack/androidx/migrate

You have a suggestion inside an error message "Suggestion: add 'tools:replace="android:appComponentFactory"" But my opinion and advice - move to androidX你在错误消息中有一个建议“建议:添加'tools:replace =“android:appComponentFactory””但我的意见和建议 - 移动到androidX

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 firebase 依赖项添加到 android 应用程序时,应用脚本 build.gradle 错误 - Apply script build.gradle error when adding firebase dependencies to an android app 添加后无法构建项目 Firebase 性能 - Android - Unable to build project after adding Firebase Performance - Android Firebase 消息传递 v1 401 项目不允许错误 - Firebase Messaging v1 401 Project Not Permitted error 添加 Firebase Analytics Nuget 后获取属性“buttonSize”已定义为不兼容的格式错误 - Getting Attribute "buttonSize" already defined with incompatible format error after adding Firebase Analytics Nuget 在 Android 中添加 Firebase Crashlytics 时生成同步错误 - Build sync error while adding Firebase Crashlytics in Android 将 Firebase Analytics 和 Crashlytics 添加到具有多个方案的 iOS 项目 - Add Firebase Analytics and Crashlytics to iOS project with multiple schemes 在android中添加图片到firebase? - Adding images to firebase in android? 部署 firebase 项目时出现错误显示“找不到模块 firebase-functions” - Error shows 'cannot find module firebase-functions' when deploying a firebase project 用于 Android/Kotlin 应用程序中用户视图的 Firebase Analytics - Firebase Analytics for User View in Android/Kotlin App Android 工作室 - 将 firebase 项目更改为 android 应用程序 - Android studio - Change firebase project for an android app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM