Build Fail with 'com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.firebase.FirebaseApp'

♀尐吖头ヾ 提交于 2019-12-09 03:51:08

问题


Hello when i implementing

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

I am getting the error like

Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.firebase.FirebaseApp

I have tried the below steps

  • Clear Project
  • Invalid catch and restart
  • Rebuild

But still getting same error. I i removed com.google.firebase:firebase-admin:6.8.0 then i work well without it.

Here my 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'

My root project 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 and Support versions which i am using

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

I have tried using multidix and also referred more links but still didnt get any solutions.


回答1:


The Firebase Admin SDK isn't supported for use in Android apps. It's intended for use in server applications.



来源:https://stackoverflow.com/questions/55438633/build-fail-with-com-android-tools-r8-utils-abortexception-error-program-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!