1

我在 build.gradle 文件中添加了以下依赖项

编译 'javax.json.bind:javax.json.bind-api:1.0.0-M2' 它会抛出类似的错误

错误:任务“:app:transformClassesWithDesugarForDebug”执行失败。

com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: 使用主类 com.google.devtools 执行 java 进程时出错。 build.android.desugar.Desugar 带参数 {--input /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/11.jar --output /Users/panmoh/Documents/AndroidMockUps/app /build/intermediates/transforms/desugar/debug/10.jar --input /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/6.jar --output /Users/panmoh/Documents /AndroidMockUps/app/build/intermediates/transforms/desugar/debug/5.jar --input /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/19。jar --output /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/desugar/debug/18.jar --input /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/ debug/18.jar --output /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/desugar/debug/17.jar --input /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/ transforms/stackFramesFixer/debug/26.jar --output /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/desugar/debug/21.jar --input /Users/panmoh/Documents/AndroidMockUps/app/ build/intermediates/transforms/stackFramesFixer/debug/4.jar --output /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/desugar/debug/3.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/classes/debug --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/0.jar - -classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/3.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/ 4.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/5.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/ stackFramesFixer/debug/6.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/7。jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/8.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/ debug/9.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/10.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/ transforms/stackFramesFixer/debug/11.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/12.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/ build/intermediates/transforms/stackFramesFixer/debug/13.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/14。jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/15.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/ debug/16.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/17.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/ transforms/stackFramesFixer/debug/18.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/19.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/ build/intermediates/transforms/stackFramesFixer/debug/20.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/21。jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/debug/26.jar --classpath_entry /Users/panmoh/Documents/AndroidMockUps/app/build/intermediates/transforms/stackFramesFixer/ debug/27.jar --bootclasspath_entry /Users/panmoh/Library/Android/sdk/platforms/android-26/android.jar --bootclasspath_entry /Users/panmoh/Library/Android/sdk/platforms/android-26/optional/ org.apache.http.legacy.jar --bootclasspath_entry /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/jre/lib/resources.jar --bootclasspath_entry /Applications/Android Studio.app/Contents/ jre/jdk/Contents/Home/jre/lib/rt.jar --bootclasspath_entry /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/jre/lib/jsse.jar --bootclasspath_entry /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/jre/lib/jce。jar --bootclasspath_entry /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/jre/lib/charsets.jar --min_sdk_version 15 --desugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}

这是我的 build.gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.canwin.androidmockups"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.uncopt:android.justified:1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'

}
4

2 回答 2

2

我在 build.gradle 文件中使用了以下内容:

实现组:'javax.json.bind',名称:'javax.json.bind-api',版本:'1.0'

于 2018-10-06T04:14:30.380 回答
0

转到此链接并下载jar 文件,然后在app->libs文件夹中添加您的项目文件夹。然后同步的项目

https://mvnrepository.com/artifact/javax.json.bind/javax.json.bind-api/1.0.0-M2

解决方案2:

错误:任务“:app:transformClassesWithDesugarForDebug”执行失败。

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: 使用主类 com.google.devtools.build.android.desugar 执行 java 进程时出错。用参数脱糖

打开您的build.gradle并在下面使用

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"

然后Clean-Rebuild-Run

于 2018-04-26T07:02:03.393 回答