xternalNativeBuildDebug失败android

xternalNativeBuildDebug失败android

本文介绍了摇篮>任务:app:externalNativeBuildDebug失败android_gradle_build.json(无此文件或目录)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

./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在忽略最新检查的同时运行所有任务.来自分级文档:

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:

这篇关于摇篮>任务:app:externalNativeBuildDebug失败android_gradle_build.json(无此文件或目录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 02:58