0

I'm developing an app the contain google maps so I followed the instructions in Google page https://developers.google.com/maps/documentation/android-api/start

When I sync the file everything works fine, but each time I try to run it I got an exception that said:

    Error:Execution failed for task 

':app:transformClassesWithDexForDebug'.
  > com.android.build.api.transform.TransformException: 
   com.android.ide.common.process.ProcessException: 
   org.gradle.process.internal.ExecException:
   Process 'command 'C:\Program    Files\Java\jdk1.8.0_31\bin\java.exe''   
   finished with non-zero exit value 3

This is my gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.tellme.mapwithmarker"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.android.support:multidex:1.0.0'
}

until now there is nothing in the project expect the map fragment and the main java class.

I will appreciate any help for solving this error.

Thanks.

Yogesh Borhade
  • 694
  • 1
  • 10
  • 24
Lolowh
  • 3
  • 2

3 Answers3

0

Add this below buildTypes in gradle

dexOptions {
    // incremental true
    javaMaxHeapSize "4g"

}
Abhishek Jaiswal
  • 628
  • 6
  • 17
0

Instead of using all play services in your project, use the required one.

Use compile 'com.google.android.gms:play-services-maps:10.0.1’

instead of

compile 'com.google.android.gms:play-services:10.0.1'

Reference Link : https://developers.google.com/android/guides/setup

Jayamurugan
  • 542
  • 2
  • 10
0

You need to change

 `compile 'com.google.android.gms:play-services:10.0.1'` 

to

`compile 'com.google.android.gms:play-services-maps:10.0.1'`

use Below Gradle file it will work fine i have checked at my side

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {

        applicationId "com.example.tellme.mapwithmarker"

        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
   // compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile 'com.android.support:multidex:1.0.0'
}
Yogesh Borhade
  • 694
  • 1
  • 10
  • 24