React-native build error: Execution failed for task ':react-native-maps:prepareComAndroidSupportAppcompatV72301Library'. > Could not expand ZIP

可紊 提交于 2019-12-13 17:15:24

问题


I created a new react-native project on a Windows 10 system, installed the react-native-maps package and rnpm link, but when starting the project I get a Build failed error.

What is causing this problem?

react-native init myapp
npm install react-native-maps --save
rnpm link
react-native run-android

Versions

react-native-cli: 1.3.0
react-native: 0.39.1
node: v7.2.1
npm: 3.10.10

Error

JS server already running.
Running C:\Users\y\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:react-native-maps:compileLint
:react-native-maps:copyReleaseLint UP-TO-DATE
:react-native-maps:preBuild UP-TO-DATE
:react-native-maps:preReleaseBuild UP-TO-DATE
:react-native-maps:checkReleaseManifest
:react-native-maps:preDebugAndroidTestBuild UP-TO-DATE
:react-native-maps:preDebugBuild UP-TO-DATE
:react-native-maps:preDebugUnitTestBuild UP-TO-DATE
:react-native-maps:preReleaseUnitTestBuild UP-TO-DATE
:react-native-maps:prepareComAndroidSupportAppcompatV72301Library FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-maps:prepareComAndroidSupportAppcompatV72301Library'.
> Could not expand ZIP 'C:\Users\y\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\appcompat-v
7\23.0.1\appcompat-v7-23.0.1.aar'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 7.247 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

(node:8824) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read prop
erty 'message' of undefined
(node:8824) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are
not handled will terminate the Node.js process with a non-zero exit code.

回答1:


I had this problem. Try to open your project in Android Studio. In right corner there are some notifications, you need to update Android build-tools and platform-tools.




回答2:


I'm facing such issues quite often this is windows problem. As I understand it happens because expanding zip takes too much time and builder fails. I've minimized such warnings by moving project folder to ssd and by adding project folder to exceptions for my anti-virus software

just execute 'react-native run-android' more and more and it will be finished in some time




回答3:


You need to make the following according to this issue

cd android && gradlew clean && cd .. && react-native run-android



回答4:


on windows

cd android 
gradlew clean 
cd ..
react-native run-android

or

cd android && gradlew clean && cd .. && react-native run-android


来源:https://stackoverflow.com/questions/41064060/react-native-build-error-execution-failed-for-task-react-native-mapspreparec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!