简体   繁体   English

任务':app“ dexDebug的Android Studio执行失败

[英]Android Studio Execution failed for task ':app"dexDebug

sorry for my bad language; 对不起,我的语言不好。 I had project in android studio and when i running it the gradle finish with this error 我在android studio中有项目,当我运行它时,gradle完成并出现此错误

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.8.0_45\bin\java.exe'' finished with non-zero exit value 2

i use 'org.apache.http.legacy' , ZXing and Retrofit Library. 我使用'org.apache.http.legacy',ZXing和Retrofit库。 i try to re import project , delete .jar files not working - minSDk: 11 -targetedSDK: 23 我尝试重新导入项目,删除不可用的.jar文件-minSDk:11 -targetedSDK:23

here is a screenshot from my dependencies enter image description here 这是我依赖项的屏幕截图, 在此输入图像描述

Enable multidex in the following way. 通过以下方式启用multidex。 Step 1: Write multiDexEnabled true inside defaultConfig in your build.gradle(app) 步骤1:在build.gradle(app)的defaultConfig中写入multiDexEnabled true

android {
...
    defaultConfig {
   ...
     multiDexEnabled true
    }
...
}

Step 2: Write 步骤2:撰写

compile 'com.android.support:multidex:1.0.1' in your dependencies in the app level build.gradle 在应用程序级别build.gradle中的依赖项中编译'com.android.support:multidex:1.0.1'

Step 3: Build your app, Then make your application class extend MultidexApplication 步骤3:构建您的应用程序,然后使您的应用程序类扩展MultidexApplication

public class YourApplication extends MultiDexApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        ...
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM