应用程序正在配置为使用Room库,同时工作室请求更新支持库的内部版本号并停止此错误。
日志还有一个使用java 8的警告,因为room-compiler仅使用Java 7进行处理。但是,那一定很好!!
由于以下问题而无法构建应用程序:
Error: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:471)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:319)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:88)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:85)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.LambdaDesugaring.visitEnd(LambdaDesugaring.java:150)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:584)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDesugarForStagingDebug'.
> 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 with arguments {@E:\Code\Android\Slave\VendorApp\Kwik24\app\build\intermediates\tmp\desugar_args2042478892032008870}
* 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 4s
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:471)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:319)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:88)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:85)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.LambdaDesugaring.visitEnd(LambdaDesugaring.java:150)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:584)
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:471)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:319)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:88)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:85)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.LambdaDesugaring.visitEnd(LambdaDesugaring.java:150)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:584)
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:471)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:319)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:88)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:85)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.LambdaDesugaring.visitEnd(LambdaDesugaring.java:150)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:584)
`
App gradle文件
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "**************"
minSdkVersion 15
targetSdkVersion 22
versionCode 16
versionName "2.3"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release {
}
debug {
storeFile file('../../debug.keystore')
}
}
flavorDimensions "default"
productFlavors { ******************************* }
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
// debug{
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// }
}
}
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-annotations:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:support-core-utils:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.koushikdutta.async:androidasync:2.+'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.firebaseui:firebase-ui-auth:3.2.1'
compile 'com.google.android.gms:play-services:11.0.4'
//new libraries
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.7'
//data persistence, android architecture library - Room
implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
implementation "android.arch.lifecycle:common-java8:1.1.0"
implementation "android.arch.persistence.room:rxjava2:1.0.0"
}
apply plugin: 'com.google.gms.google-services'
项目gradle build:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:0)
当您的构建工具或sdk版本低于其他库gradle时,可能会发生这种情况。
如果你使用更高/最新的库,你的应用程序sdk版本使用更高的sdk或构建工具版本,可能会发生这种类型的错误...更改或更新你的sdk版本然后看看会发生什么