-2

getting the error "Error:Execution failed for task ':app:transformClassesWithDexForLegacyDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException"

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    // needed for okHttp from 23sdk. https://medium.com/android-news/android-networking-i-okhttp-volley-and-gson-72004efff196#.gsfpn3ez8
    useLibrary 'org.apache.http.legacy'

    dexOptions {
        javaMaxHeapSize "3g"
    }

    defaultConfig {
        applicationId "bf.io.openshop"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    buildTypes {
        debug {
            minifyEnabled false

            multiDexEnabled true
            debuggable true
            versionNameSuffix '-DEBUG'
        }

        release {
            minifyEnabled false
            debuggable true
        }
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }

    productFlavors {
        Modern {
            minSdkVersion 23
        }
        Legacy {
            minSdkVersion 15
        }
    }

    sourceSets {
        androidTest {
            resources.srcDirs += ['src/androidTest/resources']
        }
    }
}

task clearData(type: Exec) {
    def clearDataCommand = ['adb', 'shell', 'pm', 'clear', 'bf.io.openshop']
    commandLine clearDataCommand
}

repositories { mavenCentral() }



dependencies {
    //  if needed jar libraries, add them to libs folder and load them here:
    //  compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.jakewharton.timber:timber:4.1.2'
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-maps:8.4.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'mbanje.kurt:fabbutton:1.2.1'
    compile 'com.facebook.android:facebook-android-sdk:4.9.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
    compile 'com.android.support:multidex:1.0.0'


    //// Unit testing dependencies
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-all:1.10.19'
    // Set this dependency if you want to use the Hamcrest matcher library
    testCompile 'org.hamcrest:hamcrest-library:1.3'
    testCompile 'org.powermock:powermock-module-junit4:1.6.4'
    testCompile 'org.powermock:powermock-api-mockito:1.6.4'
    //// Instrumentation test dependencies
    androidTestCompile 'com.android.support:support-annotations:23.4.0'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test:rules:0.5'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
}

apply plugin: 'com.google.gms.google-services'
  • Possible duplicate of [com.android.build.transform.api.TransformException](http://stackoverflow.com/questions/32807587/com-android-build-transform-api-transformexception) – Dileep Patel Jan 17 '17 at 10:08

2 Answers2

0

you can try to clean your project ,rebuild it .It maybe ok.

志威梦
  • 136
  • 3
0

1.Try to clear cache and rebuild At path file>clearcache>clear cache and restart

  1. Add multidex support in app level gradle multudex true inside defaultConfig like this

dexOptions { javaMaxHeapSize "4g" } defaultConfig { multiDexEnabled true }

madroid
  • 336
  • 3
  • 12