почему я получаю ошибку слияния Manifest при применении библиотек аутентификации firebase и google - PullRequest
2 голосов
/ 27 июня 2019

Я пытаюсь подключить свое приложение к базе данных и использовать в нем систему аутентификации 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'

Ответы [ 2 ]

0 голосов
/ 27 июня 2019

Либо вы иммигрируете на androidX, либо понижаете рейтинг своей базы, например, я использую

implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.6'`
0 голосов
/ 27 июня 2019

Я в настоящее время на следующих версиях. Попробуйте это, это может сработать. понизить версию ядра Firebase до 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'
...