Gradle build failed.Execution failed for task':app:transformClassesWithDesugarForDebug'。对于Android Studio 3.0.1

时间:2018-02-04 22:15:08

标签: android android-studio android-gradle build.gradle

我添加了一些新的库和功能(JAX-RS),并且gradle构建失败。 我在stacktrace中得到了这个

Error:java.lang.ClassNotFoundException: Class 
org.osgi.framework.SynchronousBundleListener not found
Error:java.lang.RuntimeException: 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 {
  --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\11.jar
  --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\12.jar
  --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\18.jar
  --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\19.jar
  --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\29.jar
 --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\30.jar
 --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\16.jar
 --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\17.jar
 --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\32.jar
 --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\33.jar
 --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\19.jar
 --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\20.jar
 --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\6.jar
 --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\7.jar
 --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\13.jar
 --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\14.jar
 --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\33.jar
 --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\34.jar
 --input D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\10.jar
 --output D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\desugar\debug\11.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\classes\debug
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\0.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\1.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\2.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\3.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\4.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\5.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\6.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\7.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\8.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\9.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\10.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\11.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\12.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\13.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\14.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\15.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\16.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\17.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\18.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\19.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\20.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\21.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\22.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\23.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\24.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\25.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\26.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\27.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\28.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\29.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\30.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\31.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\32.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\33.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\34.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\35.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\36.jar
 --classpath_entry D:\Programing practice\AndProj\DummyPracticeApplication_01_09_2018\app\build\intermediates\transforms\stackFramesFixer\debug\37.jar
 --bootclasspath_entry C:\Users\Echo01\AppData\Local\Android\Sdk\platforms\android-26\android.jar
 --bootclasspath_entry C:\Users\Echo01\AppData\Local\Android\Sdk\platforms\android-26\optional\org.apache.http.legacy.jar
 --bootclasspath_entry C:\Program Files\Android\Android Studio\jre\jre\lib\resources.jar --bootclasspath_entry C:\Program Files\Android\Android Studio\jre\jre\lib\rt.jar
 --bootclasspath_entry C:\Program Files\Android\Android Studio\jre\jre\lib\jsse.jar
 --bootclasspath_entry C:\Program Files\Android\Android Studio\jre\jre\lib\jce.jar
 --bootclasspath_entry C:\Program Files\Android\Android Studio\jre\jre\lib\charsets.jar
 --min_sdk_version 21 --nodesugar_try_with_resources_if_needed
 --desugar_try_with_resources_omit_runtime_classes}
 Error:org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Android\Android Studio\jre\bin\java.exe'' finished with non-zero exit value 1

这是我的build.gradle文件

  apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.stuff.echo01.dummypracticeapplication_01_09_2018"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                arguments "-DANDROID_STL=c++_shared"
                cppFlags '-fexceptions', '-frtti', '-std=c++11'
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    externalNativeBuild {
        cmake {
            path '../CMakeLists.txt'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'

    implementation 'org.glassfish.jersey.core:jersey-client:2.26'

    implementation 'org.glassfish.jersey.inject:jersey-hk2:2.26'

    implementation 'org.glassfish.jersey.media:jersey-media-json-processing:2.26'

    implementation 'org.glassfish.jersey.media:jersey-media-json-binding:2.26'
    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'

}

我尝试清洁 - > 重建 - >的运行即可。没有工作。 如何解决这个问题?

我尝试过thisthis的解决方案。到目前为止没有任何工作。

1 个答案:

答案 0 :(得分:0)

我遇到了@foreach($user->getRelation('shares') as $share) {{ $share->links->first()->title }} {{ $share->id }} @endforeach 个依赖项之一的问题。其中一个依赖项需要缺少OSGI。我将所有Jersey依赖项替换为Jersey
问题解决了。