等级 >任务 :app:externalNativeBuildDebug FAILED android_gradle_build.json (没有这样的文件或目录) [英] gradle > Task :app:externalNativeBuildDebug FAILED android_gradle_build.json (No such file or directory)
问题描述
我正在尝试使用
./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)
如果我在 Android Studio 中运行 Sync Project with Gradle Files
它可以解决问题.
If I run Sync Project with Gradle Files
in Android Studio it fixes the problem.
如何从命令行执行此操作,这样我就不必为了这个基本的事情而启动 Android Studio?
How do I do this from the command line so I don't have to launch Android Studio just for this basic thing?
还要注意的是,在较新版本的 Gradle 中 .externalNativeBuild
已被替换为 .cxx
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
我的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
推荐答案
尝试使用 --rerun-tasks
命令行参数重新运行所有任务.这将强制 Gradle 运行所有任务,同时忽略最新检查.来自 Gradle 文档:
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:
这将强制 test
[...或者在您的情况下,app
] 和 test
的所有任务依赖项执行.这有点像运行 gradle clean test
,但没有构建的生成的输出被删除.
This will force
test
[...or in your case,app
] and all task dependencies oftest
to execute. It’s a little like runninggradle clean test
, but without the build’s generated output being deleted.
这篇关于等级 >任务 :app:externalNativeBuildDebug FAILED android_gradle_build.json (没有这样的文件或目录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!