0

当我实现 firebase 管理库时,它显示了我在下面的应用程序和项目级 gradle 文件之后提到的错误。

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
}

下面是错误信息,

在项目“app”中,已解析的 Google Play 服务库依赖项依赖于另一个确切版本(例如“[1.21.0]”,但未解析为该版本。库表现出的行为将是未知的。

4

2 回答 2

0

删除这个:

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

您无法在 Android 应用中有效地使用 Firebase Admin SDK。它仅适用于在后端服务器和台式机上运行的代码。

此外,您应该始终确保您的 Android 客户端库依赖项是发行说明中显示的当前版本。您的 Firebase-UI 库版本还应与其他 Firebase 库匹配。

于 2020-03-14T16:59:38.047 回答
0
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 
于 2020-03-14T11:51:09.020 回答