Ошибка в реализации Firebase Admin SDK в android студии - PullRequest
0 голосов
/ 14 марта 2020

Когда я внедряю библиотеки администратора Firebase, появляется ошибка, о которой я упоминал, после того, как мои файлы уровня приложения и проекта ниже:

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

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    configurations {
        all*.exclude module: 'support-v4' // This removes all other versions of `support-v4` if gets duplicated from all the artifacts.
    }

    defaultConfig {
        applicationId "com.example.trolificnss"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

        testInstrumentationRunner "androidx.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.firebaseui:firebase-ui-auth:6.2.0"
    implementation 'com.google.firebase:firebase-auth:19.2.0'

    implementation 'com.google.firebase:firebase-admin:6.12.2'

    implementation 'com.google.firebase:firebase-analytics:17.2.3'
    implementation 'com.google.firebase:firebase-firestore:21.4.1'
    implementation 'com.firebaseui:firebase-ui-database:6.2.0'
    implementation 'com.firebaseui:firebase-ui-storage:6.2.0'
    implementation "com.google.firebase:firebase-firestore:21.4.1"
    implementation "com.firebaseui:firebase-ui-firestore:6.2.0"
    implementation 'com.firebaseui:firebase-ui-database:6.2.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.firebaseui:firebase-ui-firestore:6.2.0'
    implementation 'com.google.firebase:firebase-storage:19.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.firebaseui:firebase-ui-auth:6.2.0'
    implementation 'net.schmizz:sshj:0.10.0'
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {


    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Ниже приведено сообщение об ошибке,

В проекте «приложение» разрешенная зависимость библиотеки служб Google Play зависит от другой в конкретной версии (например, «[1.21. 0]», но не разрешается в этой версии. Поведение, демонстрируемое библиотекой, будет неизвестно.

Ответы [ 2 ]

0 голосов
/ 14 марта 2020

Удалите это:

implementation 'com.google.firebase:firebase-admin:6.12.2'

Невозможно эффективно использовать Firebase Admin SDK в приложении Android. Он предназначен только для кода, который выполняется на внутренних серверах и настольных компьютерах.

Кроме того, вы всегда должны убедиться, что ваши Android зависимости клиентской библиотеки соответствуют текущим версиям, указанным в примечаниях к выпуску , Ваши версии библиотеки Firebase-UI также должны соответствовать другим библиотекам Firebase.

0 голосов
/ 14 марта 2020
buildscript {
    ext.kotlin_version = '1.2.21'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

---------------------------------------------------------------------------
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26

    defaultConfig {
        applicationId "org.solamour.myserver"
        minSdkVersion 14
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath false
            }
        }
        resConfigs "auto"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    // Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'.
    // Resolved versions for app (1.3.9) and test app (2.0.1) differ.
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'    // Or "1.3.9".
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    implementation 'com.google.firebase:firebase-admin:4.1.6'
    implementation 'com.android.support:multidex:1.0.2'
}




take a look at the javadoc for FirebaseOptions Builder in the Android client library:

com.google.firebase.FirebaseOptions.Builder

Now look at the same class from the java Admin SDK (note the URL is different):

com.google.firebase.FirebaseOptions.Builder 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...