使用'com.android.tools.r8.utils.AbortException构建失败:错误:程序类型已存在:com.google.firebase.FirebaseApp' [英] Build Fail with 'com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.firebase.FirebaseApp'
问题描述
在实施
实施'com.google.firebase:firebase-admin:6.8.0'
implementation 'com.google.firebase:firebase-admin:6.8.0'
我遇到类似
原因:com.android.tools.r8.utils.AbortException:错误:程序类型已存在:com.google.firebase.FirebaseApp
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.firebase.FirebaseApp
我尝试了以下步骤
- 清除项目
- 无效的捕获并重新启动
- 重建
但是仍然出现相同的错误.我删除了 com.google.firebase:firebase-admin:6.8.0 ,但没有它,我也能很好地工作.
But still getting same error. I i removed com.google.firebase:firebase-admin:6.8.0 then i work well without it.
这是我的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 ,并且还引用了更多链接,但仍然没有任何解决方案.
I have tried using multidix and also referred more links but still didnt get any solutions.
推荐答案
Android应用程序不支持Firebase Admin SDK.它旨在用于服务器应用程序.
The Firebase Admin SDK isn't supported for use in Android apps. It's intended for use in server applications.
这篇关于使用'com.android.tools.r8.utils.AbortException构建失败:错误:程序类型已存在:com.google.firebase.FirebaseApp'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!