问题描述
我不想开始与此问题相关的新问题,因为我知道已经有一些问题了,但是我仍然没有找到解决方案,而且我还是很困惑.
I didn't want to start a new question related to this issue since I know there are a few already, but I still haven't found a solution and I'm pretty stuck.
我当前收到错误消息:
错误:任务':app:transformClassesWithDexForDebug'的执行失败.
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
这就是Gradle Console的显示方式
And this is what the Gradle Console is showi
失败
失败:构建失败,并出现异常.
FAILURE: Build failed with an exception.
-
出了什么问题:任务':app:transformClassesWithDexForDebug'的执行失败.
What went wrong: Execution failed for task ':app:transformClassesWithDexForDebug'.
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
建立失败
这是我的build.gradle:
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.andrewnwalker.mousetimes_california"
minSdkVersion 15
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 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: ['Parse-*.jar'])
compile files('libs/Parse-1.12.0.jar')
compile files('libs/bolts-tasks-1.3.0.jar')
compile files('libs/universal-image-loader-1.9.5.jar')
compile files('libs/joda-time-2.9.1.jar')
}
我已经尝试了所有显而易见的事情,例如清洁,重建,打开/关闭.我还尝试过删除一些依赖项,以查看是否有帮助.
I've tried all of the obvious things such as cleaning, rebuilding, opening/closing. I've also tried removing some of the dependencies to see if that would make a difference.
据我所知,自正常运行以来,我并未进行任何更改.我很确定我刚刚连续第二次运行该项目,并且出现了错误.不过我可能错了.
As far as I know I didn't change anything from when it worked fine. I'm pretty sure I just ran the project for a second time in a row and the error appeared. I might be wrong though.
有人有建议吗?
推荐答案
最近,我遇到了同样的问题,这是我的解决方案,分两个步骤:
Recently, I encountered the same problem and here is my solution with 2 steps:
-
顶级Gradle:
Top level Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3'//for any google libs
}
}
allprojects {
repositories {
jcenter()
}
}
模块(应用程序)级别的Gradle:
Module(app) level Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "your_app_id"
minSdkVersion 9
targetSdkVersion 22
// Enabling multidex support can also help (uncomment and test)
//multiDexEnabled true
}
buildTypes {
release {
//minifyEnabled true
//shrinkResources true
proguardFiles 'proguard-project.txt'
}
}
}
dependencies {
//your dependencies
}
apply plugin: 'com.google.gms.google-services' **//Place this line at the end if you use any google service lib.**
这篇关于任务':app:transformClassesWithDexForDebug'的执行失败-Gradle依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!