':应用程序:dexDebug“。失败的gradle“C:\\ Program Files文件\\的Java \\ jdk1.7.0_51 \\斌\\ java.exe的'非零退出值2结束 [英] ':app:dexDebug'. gradle failed 'C:\Program Files\Java\jdk1.7.0_51\bin\java.exe'' finished with non-zero exit value 2

查看:186
本文介绍了':应用程序: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);
    }
}

这篇关于':应用程序:dexDebug“。失败的gradle“C:\\ Program Files文件\\的Java \\ jdk1.7.0_51 \\斌\\ java.exe的'非零退出值2结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆