我已经检查了来自 Stack 的所有类似答案,并且我还查找了 GitHub 问题,但没有任何运气。
当我安装反应原生地图插件时出现问题,在构建过程中我收到 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)Androidandroid-sdkbuild-tools23.0.3aapt.exe'' finished with non-zero exit value 1
Google Maps API已正确添加到AndroidManifest文件中。另外一句话,我还看到许多警告,例如
...node_modulesreact-native-mapsandroidbuildintermediatesexploded-aarcom.google.android.gmsplay-services-base9.8.0resdrawablecommon_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'
有什么想法可以解决问题吗?
我最近遇到了同样的错误,应该更加注意错误消息。消息清楚地说明了这一点。 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",单击权限,单击标记为"执行"的复选框
3)再次运行./gradlew clean && ./gradlew assembleDebug
,你应该很高兴!!
问题解决了。一个问题是长文件路径和 npm 未正确安装 react-native-maps 模块(没有所有必需的资源文件)。
在"编译"期间
react-native run-android
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: Failed to execute aapt
我能够解决此错误的方法是进入文件夹node_modules/react-native-maps/lib/android
并使用{root}/android/app
级别build.gradle
版本中的相应compileSdkVersion
、buildToolsVersion
、minSdkVersion
和targetSdkVersion
编辑build.gradle
文件。
此修复程序适用于其他各种新安装的软件包,这些软件包在尝试react-native run-android
时导致错误。希望这有帮助!