简体   繁体   中英

Execution failed for task ':app:packageDebug' on react native cli run android

Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > java.io.IOException: Failed to read zip file 'C:\Users\PC\stuff\Project\android\app\build\outputs\apk\debug\..\..\..\..\..\release\APP-1.0.8.apk'.

For some reason I am randomly getting this error when trying to run my react native app on android via the react native CLI (react-native run-android). What is weird is this happened randomly, everything was working fine, and I made no changes, this just randomly started happening today. I had it running on my emulator, killed my metro server for a second, went to start everything back up via the command and started getting this error. I tried a few things such as deleting the build folder, running gradlew clean, and pretty much every other thing I could find online for this issue and nothing seems to work.

C:\Users\PC\stuff\Project\android\app\build\outputs\apk\debug\..\..\..\..\..\release\APP-1.0.8.apk

This path does not exist after apk\debug so I am pretty sure it has to do with that but I have no idea how to fix it. And the fact this happened randomly without me making any changes after everything working perfect has me even more confused lol. Has anyone ran into this that may know how to solve it? After a few hours of messing with it and trying everything possible that was online already I am stumped.

To fix this, I had to completely delete the project folder. Then I downloaded the project from my repo and just readded it into the folder and reinstalled all the node modules. That fixed it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM