简体   繁体   中英

Cant run React Native Project on Emulator anymore

for some reason my App wont start up on my AS Emulator. Yesterday everything was working great but today it doenst work - might be because I moved npm and npm-cache folder but they are set correctly with npm config.

Metro server starts OK and if I just selected the app it would load it up but now it insta crashes..

If I try to run npm android I am getting the error below:

    PS C:\Dev\Programmierung\FitnessApp\FitnessApp> npm run android

> FitnessApp@0.0.1 android C:\Dev\Programmierung\FitnessApp\FitnessApp
> react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1158 file(s) to forward-jetify. Using 6 workers...
info Starting JS server...
Der Befehl "adb" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:transformClassesWithDexBuilderForDebug FAILED

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

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> Unable to delete directory 'C:\Dev\Programmierung\FitnessApp\FitnessApp\android\app\build\intermediates\transforms\dexBuilder\debug\0\androidx\appcompat' after 10 attempts

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

* Get more help at https://help.gradle.org

BUILD FAILED in 17s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> Unable to delete directory 'C:\Dev\Programmierung\FitnessApp\FitnessApp\android\app\build\intermediates\transforms\dexBuilder\debug\0\androidx\appcompat' after 10 attempts

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

* Get more help at https://help.gradle.org

BUILD FAILED in 17s

    at makeError (C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\execa\index.js:174:9)
    at C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async runOnAllDevices (C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
    at async Command.handleAction (C:\Dev\Programmierung\FitnessApp\FitnessApp\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! FitnessApp@0.0.1 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the FitnessApp@0.0.1 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Dev\npm\npm-cache\_logs\2020-04-24T08_01_58_811Z-debug.log

The fixx for me was to:

cd android

./gradlew clean

and rebuild app twice

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