gpt4 book ai didi

Java.exe 在 Android Studio 中以非零退出值 2 结束

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:04:09 26 4
gpt4 key购买 nike

当我添加 compile 'org.apache.httpcomponents:httpmime:4.2.3' 后出现此错误。找不到解决方案我还在默认配置部分尝试了多个 dex 文件。我还尝试创建另一个成功运行的测试应用程序。

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

这是我的build.gradle 文件。

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.example.qualwebs.assistme"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'org.apache.httpcomponents:httpmime:4.2.3'
}

最佳答案

The Android plugin for Gradle available in Android SDK Build Tools 21.1 and higher supports multidex as part of your build configuration. Make sure you update the Android SDK Build Tools tools and the Android Support Repository to the latest version using the SDK Manager before attempting to configure your app for multidex.

将您的应用开发项目设置为使用 multidex 配置需要您对应用开发项目进行一些修改。特别是您需要执行以下步骤:

  1. 更改 Gradle 构建配置以启用 multidex
  2. 修改 list 以引用 MultiDexApplication 类

修改您的应用 Gradle 构建文件配置以包含支持库并启用 multidex 输出。

    android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
...
minSdkVersion 19
targetSdkVersion 23
...

// Enabling multidex support.
multiDexEnabled true
}
...
}

dependencies {
compile 'com.android.support:multidex:1.0.1'
}

在您的 list 中,将 multidex 支持库中的 MultiDexApplication 类添加到应用程序元素。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>

已编辑

你可以使用

compile 'org.apache.httpcomponents:httpmime:4.5.1' 

阅读

https://developer.android.com/intl/es/tools/building/multidex.html

关于Java.exe 在 Android Studio 中以非零退出值 2 结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34285406/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com