Why Execution failed for task ':app:externalNativeBuildClean?

2.6k views Asked by At

When i run below gradle.gradle its building with out issues where as in APpCenter am getting below issue please assist someone no clue sofar why this is issues only in AppCenter

Configure project :app
2020-10-22T15:53:29.5724880Z Resolved com.google.gms:google-services:4.3.4 in :app:classpath 
2020-10-22T15:53:29.5726230Z Resolved com.google.firebase:firebase-crashlytics-gradle:2.3.0 in :app:classpath 
2020-10-22T15:53:44.3531270Z Project app at :app is either no Android app project or build version has not been set to override. Skipping...
2020-10-22T15:53:53.5603560Z Resolved org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.10 in :app:kotlinCompilerClasspath 
2020-10-22T15:54:20.8955890Z Checking the license for package CMake 3.10.2.4988404 in /Users/runner/Library/Android/sdk/licenses
2020-10-22T15:54:20.8957030Z License for package CMake 3.10.2.4988404 accepted.
2020-10-22T15:54:21.2658590Z Preparing "Install CMake 3.10.2.4988404 (revision: 3.10.2)".
2020-10-22T15:55:16.4483640Z "Install CMake 3.10.2.4988404 (revision: 3.10.2)" ready.
2020-10-22T15:55:16.4500400Z Installing CMake 3.10.2.4988404 in /Users/runner/Library/Android/sdk/cmake/3.10.2.4988404
2020-10-22T15:55:16.4501290Z "Install CMake 3.10.2.4988404 (revision: 3.10.2)" complete.
2020-10-22T15:55:19.4852670Z "Install CMake 3.10.2.4988404 (revision: 3.10.2)" finished.
2020-10-22T15:55:19.8868630Z 
2020-10-22T15:55:19.8870500Z > Task :clean UP-TO-DATE
2020-10-22T15:55:19.8871590Z > Task :app:preBuild UP-TO-DATE
2020-10-22T15:55:19.8872720Z > Task :app:preBookmybasketsDebugBuild UP-TO-DATE
2020-10-22T15:55:19.9583860Z 
2020-10-22T15:55:19.9594450Z > Task :app:externalNativeBuildCleanBookmybasketsDebug FAILED
2020-10-22T15:55:19.9596220Z Clean native-lib armeabi-v7a
2020-10-22T15:55:20.1544910Z 
2020-10-22T15:55:20.1624950Z FAILURE: Build failed with an exception.
2020-10-22T15:55:20.1649800Z 
2020-10-22T15:55:20.1650710Z * What went wrong:
2020-10-22T15:55:20.1652140Z Execution failed for task ':app:externalNativeBuildCleanBookmybasketsDebug'.
2020-10-22T15:55:20.1653300Z > A problem occurred starting process 'command 'C:Usersveerendra''
2020-10-22T15:55:20.1653830Z 
2020-10-22T15:55:20.1654260Z * Try:
2020-10-22T15:55:20.1655650Z Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
2020-10-22T15:55:20.1656340Z 
2020-10-22T15:55:20.1656820Z * Get more help at https://help.gradle.org
2020-10-22T15:55:20.1657250Z 
2020-10-22T15:55:20.1657650Z BUILD FAILED in 4m 9s
2020-10-22T15:55:20.1658560Z 2 actionable tasks: 1 executed, 1 up-to-date
2020-10-22T15:55:20.7918810Z Error: /Users/runner/work/1/s/gradlew failed with return code: 1
2020-10-22T15:55:20.7922980Z     at ChildProcess.<anonymous> (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
2020-10-22T15:55:20.7924290Z     at emitTwo (events.js:106:13)
2020-10-22T15:55:20.7924720Z     at ChildProcess.emit (events.js:191:7)
2020-10-22T15:55:20.7925050Z     at maybeClose (internal/child_process.js:920:16)
2020-10-22T15:55:20.7925420Z     at Socket.<anonymous> (internal/child_process.js:351:11)
2020-10-22T15:55:20.7925750Z     at emitOne (events.js:96:13)
2020-10-22T15:55:20.7926030Z     at Socket.emit (events.js:188:7)
2020-10-22T15:55:20.7926380Z     at Pipe._handle.close [as _onclose] (net.js:509:12)
2020-10-22T15:55:20.7986170Z ##[error]Error: /Users/runner/work/1/s/gradlew failed with return code: 1
2020-10-22T15:55:20.8017170Z ##[section]Finishing: Gradle Task
2020-10-22T15:55:20.8764540Z ##[section]Starting: Checkout FoodApp_Prod@Develop1 to s
2020-10-22T15:55:20.8772720Z ==============================================================================
2020-10-22T15:55:20.8773110Z Task         : Get sources
2020-10-22T15:55:20.8773500Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-10-22T15:55:20.8773890Z Version      : 1.0.0
2020-10-22T15:55:20.8774140Z Author       : Microsoft
2020-10-22T15:55:20.8775070Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-10-22T15:55:20.8775510Z ==============================================================================
2020-10-22T15:55:21.3628440Z Cleaning any cached credential from repository: FoodApp_Prod (ExternalGit)
2020-10-22T15:55:21.3723310Z ##[section]Finishing: Checkout FoodApp_Prod@Develop1 to s
2020-10-22T15:55:21.3801870Z ##[section]Starting: Finalize Job
2020-10-22T15:55:21.3845630Z Cleaning up task key
2020-10-22T15:55:21.3850450Z Start cleaning up orphan processes.
2020-10-22T15:55:21.4941020Z Terminate orphan process: pid (1303) (java)
2020-10-22T15:55:21.5584650Z ##[section]Finishing: Finalize Job
2020-10-22T15:55:21.5939110Z ##[section]Finishing: Build

I Am facing above exception while building app in Azure App Center where as build is successful in android studio.Here is the build.gradle i am using any help is appreciated

 android {
compileSdkVersion 29

defaultConfig {
    applicationId "org.delivery.pizza.pizzadelivery"
    minSdkVersion 21
    targetSdkVersion 29
    versionCode 60
    versionName "0.60"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true

    externalNativeBuild {
        cmake {
            cppFlags ""
        }
    }

    ndkVersion "21.3.6528147" // <<==== Here
}
externalNativeBuild {
    cmake {
        path "src/cpp/CMakeLists.txt"
        version "3.10.2"
    }
}
   buildFeatures{
     //         dataBinding = true
    // for view binding :
     viewBinding = true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
    checkReleaseBuilds false
    // Or, if you prefer, you can continue to check for errors in release builds,
    // but continue the build even when errors are found:
    abortOnError false
}

buildTypes {
    debug{
        shrinkResources false
        minifyEnabled false  // change to true to enable obfuscation for debug builds too
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dexOptions
        {
            javaMaxHeapSize "2g"
        }

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions "version"

sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
1

There are 1 answers

0
Eugenio Lopez On

Just faced/resolved this issue myself. CMake will autogenerate .cxx files which contain your local user paths to NDK related files. Thus, as one of the above comments mentioned, a remote platform like Azure obviously wont find such path.

You should also be able to reproduce this error locally on a different machine with a different User.

To resolve, I deleted the .cxx folder from my local and added ".cxx" to the gitignore. Push these changes to remote and it should resolve the error.