在尝试构建项目时,将gms / firebase升级到版本15.0.0会导致gradle崩溃?

时间:2018-05-03 11:19:40

标签: java android firebase google-play-services

我正在尝试更新我的项目以使用版本15. + gms / firebase但是在尝试构建项目时遇到以下问题

    :app:transformClassesWithDesugarForDebug
Exception in thread "main" java.lang.IllegalArgumentException
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
    at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
    at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
    at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
    at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
    at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
    at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)

Exception in thread "main" java.lang.IllegalArgumentException
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
    at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
    at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
    at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
    at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
    at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
    at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
    at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDesugarForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar 

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 42s

当我使用11.8.0

时,gradle会构建并且不会出现任何问题

这是应用程序gradle代码

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
    applicationId ""
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}

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

dexOptions {
    javaMaxHeapSize "4g"
}

signingConfigs {
    debug {
        keyAlias 'androidDebugKey'
        keyPassword 'android'
        storeFile file('/Users/nerdy/.android/debug.keystore')
        storePassword('android')
    }
}

compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}
}

repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso- 
core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

implementation project(':domain')
implementation project(':data')
implementation project(path: ':chat-sdk-audio-message')
implementation project(path: ':chat-sdk-video-message')
implementation project(path: ':chat-sdk-contact-book')

api 'com.android.support:appcompat-v7:27.1.1'
api 'com.android.support:cardview-v7:27.1.1'
api 'com.android.support:design:27.1.1'
api 'com.android.support:support-v4:27.1.1'
api 'com.android.support.constraint:constraint-layout:1.1.0'

api 'com.firebaseui:firebase-ui-storage:0.6.0'
api 'com.google.firebase:firebase-crash:15.0.2'
api 'com.google.firebase:firebase-auth:15.1.0'
api 'com.google.firebase:firebase-core:15.0.2'
api 'com.google.firebase:firebase-database:15.0.1'
api 'com.google.firebase:firebase-firestore:16.0.0'
api 'com.google.firebase:firebase-messaging:15.0.2'
api 'com.google.firebase:firebase-storage:15.0.2'

api 'com.google.android.gms:play-services-location:15.0.1'
api 'com.google.android.gms:play-services-maps:15.0.1'
api 'com.google.android.gms:play-services-places:15.0.1'

api 'com.jakewharton:butterknife:8.5.1'
api 'com.ncapdevi:frag-nav:1.4.0'
api 'io.reactivex.rxjava2:rxandroid:2.0.1'
api 'io.reactivex.rxjava2:rxjava:2.1.7'
api 'com.android.support:multidex:1.0.3'
api 'com.crystal:crystalrangeseekbar:1.1.3'
api 'joda-time:joda-time:2.9.9'
api 'id.zelory:compressor:2.1.0'
api 'com.airbnb.android:lottie:2.1.2'
api 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
api 'com.facebook.android:facebook-share:4.32.0'
api 'com.facebook.android:facebook-applinks:4.32.0'
api 'com.crashlytics.sdk.android:crashlytics:2.9.2'

api 'co.chatsdk.chatsdk:chat-sdk-core:' + project.CHAT_SDK_VERSION
api 'co.chatsdk.chatsdk:chat-sdk-ui:' + project.CHAT_SDK_VERSION
api 'co.chatsdk.chatsdk:chat-sdk-firebase-adapter:' + 
project.CHAT_SDK_VERSION
api 'co.chatsdk.chatsdk:chat-sdk-firebase-file-storage:' + 
project.CHAT_SDK_VERSION
api 'co.chatsdk.chatsdk:chat-sdk-firebase-push:' + 
project.CHAT_SDK_VERSION
}

configurations.all {
resolutionStrategy.eachDependency {  details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion '27.+'
        }
    }
}
}

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

这是项目gradle

buildscript {
repositories {
    jcenter()
    mavenCentral()
    google()
    maven { url 'https://maven.fabric.io/public' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.google.gms:google-services:3.3.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    classpath 'io.fabric.tools:gradle:1.25.2'
}
}

allprojects {
repositories {
    jcenter()
        maven { url "https://maven.google.com" }
        maven { url "http://dl.bintray.com/chat-sdk/chat-sdk-android" }
        maven { url "https://jitpack.io" }

    google()
}
}

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

我也试过不同版本的gradle包装器,版本4.4,4.7等......

1 个答案:

答案 0 :(得分:0)

由于firebase更新而发生了这件事,我通过此解决了

implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-storage:15.0.2'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'

点击此处: - https://firebase.google.com/support/release-notes/android