任务':app:processReleaseGoogleServices'执行失败。无法删除:..... / values.xml

时间:2018-09-25 23:19:17

标签: android react-native gradle

我有一个React Native项目。我正在为macOS上的android(我对iOS没有问题)构建发行版。我一直在遵循本指南:https://facebook.github.io/react-native/docs/signed-apk-android。运行./gradlew assembleRelease时,出现以下错误:

:app:processReleaseGoogleServices
Parsing json file: /Users/robavery/repositories/ourdailystrength_app/android/app/google-services.json
:app:processReleaseGoogleServices FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseGoogleServices'.
> Failed to delete: /Users/robavery/repositories/ourdailystrength_app/android/app/build/generated/res/google-services/release/values/values.xml

* Try:
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.

* Get more help at https://help.gradle.org

BUILD FAILED in 47s

当我尝试清理项目时,我已经清理并收到了相同的错误(无论我是通过Android Studio,./gradlew clean还是npm run clean:android进行清理)。

我尝试运行sudo ./gradlew assembleRelease,但随后出现此错误:

> Task :app:processReleaseGoogleServices
Parsing json file: /Users/robavery/repositories/ourdailystrength_app/android/app/google-services.json


FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture snapshot of input files for task ':app:bundleReleaseJsAndAssets' property '$1' during up-to-date check.
> Failed to create MD5 hash for file '/Users/robavery/repositories/ourdailystrength_app/.buckd/sock' as it does not exist.

* Try:
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.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s

不过,我希望能够以用户身份而不是sudo来运行它。

是什么导致此错误?我该如何解决这个问题,并成功进行gradle构建以发布而不必使用sudo?

1 个答案:

答案 0 :(得分:1)

如果问题是权限,这不是超级安全,但应该可以工作

sudo chmod -R 777 /Users/robavery/repositories/ourdailystrength_app

仅使用chmod将权限修改为777,这是所有组,所有权限的别名,-R标志以递归方式运行它,因此您可以命中目录中的每个文件。

如果这不起作用,则可以尝试clearing your project cache