':应用程序:dexDebug“。失败的gradle“C:\\ Program Files文件\\的Java \\ jdk1.7.0_51 \\斌\\ java.exe的'非零退出值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'
}
我可以编译和运行,如果我不使用'com.google.android.gms:播放服务:8.3.0,但是这违背了我的应用程序的目的。尝试multidexenabled。尝试清洁和重建。任何意见将是AP preciated?
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?
答
问题是你的方法数已经从65K超过。
这是你的问题的解决方案。
The problem is your method count has exceed from 65K. Here is the solution of your problem.
步骤:1使multidex支持
Step:1 enable multidex support
defaultConfig {
...
multiDexEnabled true
}
步骤:2这2行
dependencies {
...
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.android.support:multidex:1.0.0'
}
步骤:3(一)舱单更改
Step:3(a) Change in manifest
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
步骤:3(b)如果您有自己的自定义应用程序类然后初始化MultiDex这样
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);
}
}