簡體   English   中英

Android 添加 Firebase 分析時構建失敗

[英]Android fail to build when add Firebase Analytics

我正在嘗試使用此build.gradle將 firebase firebase-analytics:17.4.4添加到我的項目中:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "*************"
        minSdkVersion 21
        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.+'
    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.+'
    implementation 'com.android.support:support-v4:28.+'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation("com.squareup.okhttp3:okhttp:4.7.2")
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.github.javadev:underscore:1.55'

    implementation 'com.google.firebase:firebase-analytics:17.4.4'

    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}

當我嘗試構建項目時出現此錯誤的問題:

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:9:5-26:19 to override.

Firebase Analytics 17.0.0+ 使用 AndroidX。 因此,您必須將您的應用程序遷移到 AndroidX才能使用它。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM