本文主要是介绍Java finished with non-zero exit value 2 - Android Gradle,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
gradle 配置一下defaultConfig { // Enabling multidex support.multiDexEnabled true
}
For me the problem was, i had put a unnecessary complie library code in build.gradledependencies {compile 'com.google.android.gms:play-services:7.5.0'
}
which was causing over 65k methods, so removed it,gradle sync, cleaned project, and then ran again and then this error stopped. I needed just maps and gcm so i put these lines and synced projectcompile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-location:7.5.0'
Hi people i again encountered this problem and this time it was because of changing build tools version and it really required me to enable multidex..so i added these my app's build.gradle file..defaultConfig {applicationId "com.am.android"minSdkVersion 13targetSdkVersion 23// Enabling multidex support.multiDexEnabled true
}dexOptions {incremental truejavaMaxHeapSize "2048M"jumboMode = true
}dependencies {compile fileTree(include: ['*.jar'], dir: 'libs')compile 'com.android.support:multidex:1.0.1'
}
And create a class that extends Application class and include this method inside the class..@Override
protected void attachBaseContext(Context base) {super.attachBaseContext(base);MultiDex.install(this);
}
also include in OnCreate method too@Override
public void onCreate() {MultiDex.install(this);super.onCreate();
}
thanks to : 点击打开链接
这篇关于Java finished with non-zero exit value 2 - Android Gradle的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!