react-native-maps:processReleaseResources任务gradlew构建失败

时间:2017-01-02 13:57:19

标签: react-native react-native-android

我已经检查了Stack中的所有类似答案,并且我在GitHub Issues上查找但没有任何运气。

安装react-native-maps插件时出现问题,在构建期间我收到gradlew异常

:react-native-maps:processReleaseResources FAILED

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-maps:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1

Google Maps API已正确添加到AndroidManifest文件中。 还有一个额外的评论我也看到很多警告,比如

...\node_modules\react-native-maps\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\9.8.0\res\drawable\common_google_signin_btn_text_light_focused.xml:14:29-81 : No resource found that matches the given name (at 'drawable' with value '@drawable/common_google_signin_btn_text_light_normal').

但是在build.gradle中我添加了

的依赖项
compile 'com.google.android.gms:play-services-base:10.0.1'

如何解决问题?

3 个答案:

答案 0 :(得分:3)

我最近遇到了同样的错误,应该更加注意错误信息。消息清楚地说出来了。 Failure to execute aapt

简答:

制作aapt可执行文件

稍长答案:

1)运行cd android && ./gradlew clean && ./gradlew assembleDebug --stacktrace。输出将显示构建工具版本,您将找到正确的aapt以生成可执行文件及其路径。例如 Cannot run program "/home/user/Android/Sdk/build-tools/25.0.3/aapt" (in directory "/home/user/testproject/node_modules/react-native-maps/lib/android"): error=13, Permission denied

2)右键单击文件'aapt',单击权限,单击标记为'Execute'的复选框

3)再次运行./gradlew clean && ./gradlew assembleDebug,你应该好好去!

答案 1 :(得分:0)

问题解决了。 问题是长文件路径和npm没有正确安装react-native-maps模块(没有所有必需的资源文件)。

"汇编"

react-native run-android

gradlew任务因地图模块中缺少资源而失败

答案 2 :(得分:0)

我遇到了与此错误响应类似的问题:

:react-native-maps:processReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-maps:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

我能够解决此错误的方法是进入文件夹node_modules/react-native-maps/lib/android并使用相应的build.gradlecompileSdkVersion,{{1}编辑buildToolsVersion文件来自我的minSdkVersiontargetSdkVersion版本的{root}/android/app

此修复程序适用于其他新安装的程序包,这些程序在尝试build.gradle时导致错误。希望这有帮助!