Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle fails with error execCommand == null

I have searched for a while for this problem and am not able to solve it. I pulled a project down from a private git repo. Some people are able to build while others like myself are getting the following error:

 Error:Gradle:Execution failed for task ':ProjectName:buildNative'.
       > execCommand == null!

If anybody has encountered this and knows how to fix it, please let me know, it does not seem like a problem which is specific to the project I am on.

I think this is the part in the Gradle file where it is failing:

task buildNative(type: Exec) {
    if (System.env.ANDROID_NDK_HOME != null) {
        def ndkBuild = new File(System.env.ANDROID_NDK_HOME, 'ndk-build')
        commandLine ndkBuild
    } else {
        doLast {
            println '##################'
            println 'Skipping NDK build'
            println 'Reason: ANDROID_NDK_HOME not set.'
            println '##################'
        }
    }
}
like image 216
Kris Gellci Avatar asked Nov 11 '22 07:11

Kris Gellci


1 Answers

Seems like you don't have an ANDROID_NDK_HOME environment variable set. The code above doesn't treat that case correctly. As such, the problem is specific to your build. One way to fix it is to replace doLast with doFirst and to insert throw new StopExecutionException() after the printlns. Additionally you may have to set commandLine (or executable) to a dummy value.

like image 70
Peter Niederwieser Avatar answered Jan 04 '23 02:01

Peter Niederwieser