Mark Balfour
Mark Balfour

Reputation: 23

':app:dexDebug'. gradle failed 'C:\Program Files\Java\jdk1.7.0_51\bin\java.exe'' finished with non-zero exit value 2

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException:         org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_51\bin\java.exe'' finished with non-zero exit value 2


    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.zumoappname"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        //multiDexEnabled true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


    repositories {
        flatDir {
            dirs 'aars'
        }   
     }
  }

  dependencies { 
           compile fileTree(dir: 'libs', include: ['*.jar']) 
           compile 'com.microsoft.azure:azure-notifications-handler:1.0.1@jar' 
           compile 'com.google.code.gson:gson:2.3' 
           compile 'com.google.guava:guava:18.0' 
           compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3' 
           compile 'com.google.android.gms:play-services:8.3.0'
           compile 'com.android.support:appcompat-v7:23.1.1' 
  }

I can compile and run if I don't use 'com.google.android.gms:play- services:8.3.0', but that defeats the purpose of my app. Tried multidexenabled. Tried clean and rebuild. Any advice would be appreciated?

Upvotes: 2

Views: 3647

Answers (2)

Suhas
Suhas

Reputation: 1471

Could you please check if you have play-services version 8.3.0 in android-sdk/extras/google/m2repository/com/google/android/gms/play-services/8.3.0. If not, downloading it might fix the issue.

Upvotes: 0

Dhrumil Shah - dhuma1981
Dhrumil Shah - dhuma1981

Reputation: 15789

The problem is your method count has exceed from 65K. Here is the solution of your problem.

Step:1 enable multidex support

defaultConfig {
        ...
        multiDexEnabled true
    }

Step:2 Add These 2 lines

 dependencies {
        ...
        compile 'com.google.android.gms:play-services-location:8.3.0'
        compile 'com.android.support:multidex:1.0.0'
    }

Step:3(a) Change in manifest

 <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>

Step:3(b) If you have your own custom Application class then initialize MultiDex like this.

public class YouApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}

Upvotes: 3

Related Questions