javaandroidjava-8android-studio-3.0jsonb-api

How can i import javax.json.binding in android studio?


I add the following dependency in my build.gradle file

compile 'javax.json.bind:javax.json.bind-api:1.0.0-M2' it throws the error like

Error: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 with arguments {--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}

This my build.gradle file

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'

}

Solution

  • I used the following in my build.gradle file:

    implementation group: 'javax.json.bind', name: 'javax.json.bind-api', version: '1.0'