gpt4 book ai didi

java - 添加库后不断收到错误 Gradle Build 失败,出现异常 : java. exe' 以非零退出值 2 完成

转载 作者:行者123 更新时间:2023-12-01 09:59:27 25 4
gpt4 key购买 nike

当我将新库添加到 gradle 中时,我不断收到以下错误:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.transform.api.TransformException: 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.1'
useLibrary 'org.apache.http.legacy'


defaultConfig {
applicationId "ir.whc.news"
minSdkVersion 14
targetSdkVersion 23

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}


dependencies {


testCompile 'junit:junit:4.12'
compile project(":volley")
compile project(":AndroidBootstrap")
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:support-annotations:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.shamanland:fonticon:0.1.9'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
compile 'com.joanzapata.pdfview:android-pdfview:1.0.4@aar'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.github.satyan:sugar:1.4'
provided 'org.apache.commons:commons-collections4:4.0'


}
apply plugin: 'com.google.gms.google-services'

this SO question 接受的答案中,有记载说冲突是导致此错误的原因。我不知道我的 gradle 依赖项有什么冲突?

最佳答案

我建议不要按原样编译它,大多数时候这会导致超过 65K 方法的 dex 限制。

compile 'com.google.android.gms:play-services:8.3.0'

see here ,找出您真正需要的特定项,并根据您的需要用于特定目的,并且您似乎还忘记添加 multiDexEnabled true

关于java - 添加库后不断收到错误 Gradle Build 失败,出现异常 : java. exe' 以非零退出值 2 完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36929909/

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