gradle > Task :app:externalNativeBuildDebug FAILED android_gradle_build.json (No such file or directory)
Asked Answered
T

1

7

I am trying to build an android project from the command line using

./gradlew app:assembleDebug

However when I build the task fails with:

> Task :app:externalNativeBuildDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildDebug'.
> java.io.FileNotFoundException: /Users/hcwiley/MyProject/app/.externalNativeBuild/cmake/debug/arm64-v8a/android_gradle_build.json (No such file or directory)

If I run Sync Project with Gradle Files in Android Studio it fixes the problem.

How do I do this from the command line so I don't have to launch Android Studio just for this basic thing?

Also to note, in newer versions of Gradle .externalNativeBuild has been replaced .cxx

I've already tried these to no avail:

rm -rf app/.externalNativeBuild app/build
./gradlew cleanBuildCache
./gradlew clean

My gradle/wrapper/gradle-wrapper.properties:

#Mon Oct 07 16:53:24 CDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Textile answered 8/10, 2019 at 20:39 Comment(0)
G
24

Try rerunning all tasks using --rerun-tasks command line parameter. This will force Gradle to run all tasks while ignoring up-to-date checks. From Gradle docs:

This will force test [...or in your case, app] and all task dependencies of test to execute. It’s a little like running gradle clean test, but without the build’s generated output being deleted.

Geary answered 8/10, 2019 at 20:48 Comment(4)
./gradlew app:assembleDebug --rerun-tasks it worked !!! thank youTextile
You should file bugs whenever you have to do that, FWIW. Any time you have to manually --rerun-tasks is a bug in the dependency tracking.Shaniqua
further note for future individuals. this also fixes issues with: error: package R does not existTextile
you deserve a medal!! really!Pianola

© 2022 - 2024 — McMap. All rights reserved.