Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging failed Gradle builds in Android studio

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")
    }
}

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.

How can I pass the parameters, such as --stacktrace, from Android Studio to Gradle so I can debug why the task fails?

like image 538
Guu Avatar asked Dec 20 '22 17:12

Guu


1 Answers

On OSX: Android Studio -> Preferences -> Compiler -> Gradle -> Command-line Options

like image 132
Guu Avatar answered Dec 26 '22 12:12

Guu