Error after "run app" in android studio [duplicated]

0

I get this error in android studio when I try to launch the app (run app) to the mobile connected by usb to the pc to test it:

  

Error: Execution failed for task ': app: transformClassesWithDexForDebug'.    com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

Previously all correct, the error comes after "run app".

This is the content of the build.gradle file, in case it is helpful:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.anticoagulacionoralagssur"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    dexOptions {
            javaMaxHeapSize "2048M"
        }
        buildTypes {
            debug {
                multiDexEnabled true
            }
            release {
                multiDexEnabled true
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
}

dependencies {
    //compile possible .jar files in the libs directory...
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //Google Play Services for Google Cloud Messaging and Google Maps...
    //Firebase for push notifications
    compile 'com.google.android.gms:play-services-base:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.google.guava:guava:18.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.android.support:support-v13:25.1.0'
    compile 'com.google.android.gms:play-services:10.0.1'
}


//To enable push notifications using Firebase:
//1) Download google-services.json file from Firebase control panel
//2) Copy google-services.json file into the /app directory of your project
//3) Uncomment the following line:

//apply plugin: 'com.google.gms.google-services'

Here I bring what goes in Gradle Console when it gives the error:

Running dex as a separate process.

To run dex in process, the Gradle daemon needs a larger heap. It currently has 1024 MB. For faster builds, increase the maximum heap size for the Gradle daemon to at least 2560 MB (based on the dexOptions.javaMaxHeapSize = 2048M). To do this set org.gradle.jvmargs = -Xmx2560M in the project gradle.properties. For more information see link

: app: transformClassesWithDexForDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ': app: transformClassesWithDexForDebug'.

      

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

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

    
asked by Cosas Varias 22.02.2017 в 12:32
source

1 answer

1

Try adding multiDexEnabled true in the build.gradle file:

 defaultConfig {
    multiDexEnabled true
}
    
answered by 22.02.2017 в 12:37