使用'com.android.tools.r8.utils.AbortException构建失败:错误:程序类型已存在:com.google.firebase.FirebaseApp'

问题描述 投票:0回答:1

你好,我实施时

实施'com.google.firebase:firebase-admin:6.8.0'

我收到的错误就像

原因:com.android.tools.r8.utils.AbortException:错误:程序类型已存在:com.google.firebase.FirebaseApp

我尝试了以下步骤

  • 清除项目
  • 捕获和重启无效
  • 重建

但仍然得到同样的错误。我删除了com.google.firebase:firebase-admin:6.8.0然后我没有它工作得很好。

这是我的app / build.gradle

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
    compileSdkVersion build_versions.target_sdk

    defaultConfig {
        applicationId "com.sccpl.smartrestaurant"
        minSdkVersion build_versions.min_sdk
        targetSdkVersion build_versions.target_sdk
        versionCode build_versions.version_code
        versionName build_versions.version_name

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath false
            }
       }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
    productFlavors {
    }
    lintOptions {
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }
}


dependencies {
//    implementation fileTree(include: ['*.jar'], dir: 'libs')
    // Support libraries
    implementation deps.support.app_compat
    implementation deps.support.v4
    implementation deps.support.design
    implementation deps.support.cardview
    implementation deps.support.recyclerview
    //constraint layout
    implementation deps.constraint_layout
    implementation deps.glide.runtime
    implementation deps.staggeredtextgridview
    // Gson
    implementation deps.gson
    // dragger
    implementation deps.dagger.runtime
    implementation deps.dagger.android
    implementation deps.dagger.android_support
    annotationProcessor deps.dagger.compiler
    annotationProcessor deps.dagger.android_support_compiler
    // retrofit2
    implementation deps.retrofit.runtime
    implementation deps.retrofit.gson
    //    implementation deps.retrofit.rxjava
    //    implementation deps.retrofit.mock
    implementation deps.okhttp_logging_interceptor
    androidTestImplementation deps.atsl.runner
    androidTestImplementation deps.atsl.rules
    androidTestImplementation deps.room.testing
    androidTestImplementation deps.arch_core.testing
    // Espresso UI Testing
    androidTestImplementation deps.espresso.core
    androidTestImplementation deps.espresso.contrib
    androidTestImplementation deps.espresso.intents
    implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.0.0-RC1'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-iid:17.1.1'
    implementation 'com.google.firebase:firebase-messaging:17.5.0'
    implementation 'com.google.firebase:firebase-admin:6.8.0'

//    implementation 'com.github.shchurov:horizontalwheelview:0.9.5'
    implementation project(':SerialPortApi')
    implementation project(':library')
    annotationProcessor 'com.google.auto.value:auto-value:1.5.2'
}
//apply plugin: 'com.google.gms.google-services'

我的根项目build.gradle

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

buildscript {
    apply from: 'versions.gradle'
    addRepos(repositories)

    dependencies {
        classpath deps.android_gradle_plugin
//        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.realm:realm-gradle-plugin:5.8.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    repositories {
        google()
    }
}

allprojects {
    addRepos(repositories)
}

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

我正在使用的构建和支持版本

build_versions.min_sdk = 21
build_versions.target_sdk = 28
build_versions.build_tools = "28.0.3"
versions.support = "28.0.0"

我尝试过使用multidix并且还提到了更多的链接,但仍然没有得到任何解决方案。

android firebase firebase-admin
1个回答
4
投票

Android应用中不支持Firebase Admin SDK。它旨在用于服务器应用程序。

© www.soinside.com 2019 - 2024. All rights reserved.