简体   繁体   中英

React-Native Execution failed for task ':app:packageDebug'

Whenever I try to run 'react-native run-android'

I got failure:

Execution failed for task ':app:packageDebug'

I tried checkout to previus commits. I tried removing android/app/build and re-build I tried removing debug.keystore and initiated it again.

none of them solved the problem.

I successfully run my app before in android virtual device, and I've already uploaded my app to google play store, and it works.

I haven't seen this error before. My code worked totally fine before:

  • I removed some font files in android/src/main/assets/fonts. This maybe the reason.
  • I ran "react-native run-ios". This may be the reason.

Task :app:packageDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings 117 actionable tasks: 5 executed, 112 up-to-date

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:packageDebug'.

    4 exceptions were raised by workers: java.io.UncheckedIOException: java.io.IOException: Execution of compression failed. java.io.UncheckedIOException: java.io.IOException: Execution of compression failed. java.io.UncheckedIOException: java.io.IOException: Execution of compression failed. java.io.UncheckedIOException: java.io.IOException: Execution of compression failed.

BUILD FAILED in 22s

at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (/Users/leonkong/Desktop/dev/CoddingHippo/Native_Makkcha/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/Users/leonkong/Desktop/dev/CoddingHippo/Native_Makkcha/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/Users/leonkong/Desktop/dev/CoddingHippo/Native_Makkcha/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)

Build Success message. And running app on virtual device by android studio 2

  • Clean Gradle

    cd android

    ./gradlew clean

First try:

cd android && gradlew clean

And after that:

cd.. && react-native run-android --variant=debug

我刚刚重新启动了我的计算机并在项目的 android 文件夹中再次运行 ./gradlew assembleRelease 并且它起作用了。

I also face issue.

I just open Android Studio - Clear Build - Run app.

Works for me

I followed these steps

  1. Uninstall app from emulator
  2. Remove build from android
  3. Run ./gradlew clean in android
  4. Run react-native start --reset-cache
  5. Run react-native run-android

It worked for me

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