gpt4 book ai didi

android - Gradle构建时,任务 ':app:transformClassesWithDexForDebug'执行失败

转载 作者:行者123 更新时间:2023-12-03 04:35:18 25 4
gpt4 key购买 nike

我正在尝试将库添加到android应用程序。我已经在项目设置中将库添加为依赖项。
然后,当我尝试构建项目时,gradle显示以下错误:
错误:任务':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\bin\java.exe'' finished with non-zero exit value 1



我进行了搜索,找到了许多解决方案,但是在我的情况下,这些解决方案都无法正常工作。请在下面找到我的应用程序build.gradle和库build.gradle文件

应用程序级别build.gradle
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.application.package"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
testCompile 'junit:junit:4.12'
compile project(':library')
}

和库build.gradle
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "v0.1L"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
}

另外,在我的项目build.gradle下找到
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

我在此问题上停留了整整1天。请帮我解决这个问题。

谢谢,
拉詹

最佳答案

尝试改变

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
...

}


dependencies {
provided fileTree(dir: 'libs', include: ['*.jar'])
...

}

关于android - Gradle构建时,任务 ':app:transformClassesWithDexForDebug'执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34427024/

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