在 Android Studio 中调试失败的 Gradle 构建 [英] Debugging failed Gradle builds in Android studio
本文介绍了在 Android Studio 中调试失败的 Gradle 构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下带有任务的简单构建配置:
I have the following simple build configuration with a task:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
task compileSass(type:Exec) {
commandLine 'sass', "src/main/theme/default.scss", "src/main/assets/default.css"
}
project.afterEvaluate{
preBuild.dependsOn("compileSass")
}
}
使用 gradle installDebug
从命令行运行时,构建运行良好,但从 Android Studio 运行时失败,并出现以下错误:
The build runs just fine when run from the command line with gradle installDebug
but fails when running from Android Studio with the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':PixateTest:compileSass'.
> A problem occurred starting process 'command 'sass''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
如何将参数(例如 --stacktrace)从 Android Studio 传递到 Gradle,以便调试任务失败的原因?
How can I pass the parameters, such as --stacktrace, from Android Studio to Gradle so I can debug why the task fails?
推荐答案
在 OSX 上:Android Studio -> Preferences -> Compiler -> Gradle -> Command-line Options
On OSX: Android Studio -> Preferences -> Compiler -> Gradle -> Command-line Options
这篇关于在 Android Studio 中调试失败的 Gradle 构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文