Home > OS >  react-native run-android failed M1
react-native run-android failed M1

Time:08-09

~/RNSTAMPY  react-native run-android  1 ✘ ╱ took 41s ╱ at 10:24:15 PM info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. (node:4459) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use node --trace-warnings ... to show where the warning was created) Jetifier found 1119 file(s) to forward-jetify. Using 8 workers... info JS server already running. info Launching emulator... info Successfully launched emulator. info Installing the app...

Task :app:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings 93 actionable tasks: 2 executed, 91 up-to-date /Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected package com.rnstampy; ^ 1 error

FAILURE: Build failed with an exception.

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

Compilation failed; see the compiler error output for details.

  • 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.

BUILD FAILED in 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 /Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected package com.rnstampy; ^ 1 error

FAILURE: Build failed with an exception.

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

Compilation failed; see the compiler error output for details.

  • 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.

BUILD FAILED in 3s

at makeError (/Users/leeseungsup/RNSTAMPY/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/leeseungsup/RNSTAMPY/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/leeseungsup/RNSTAMPY/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/leeseungsup/RNSTAMPY/node_modules/@react-native-community/cli/build/index.js:192:9)

info Run CLI with --verbose flag for more details.


run-ios is ok run-android => android emulator opens but can't install my app. When I ran android emulator in EXPO cli, it worked well! but in react-native-cli environment, it doesn't work!!

react-native-cli: 2.0.1 react-native: 0.69.3

please help me~~

CodePudding user response:

First install your cocoapods with this command

arch -x86_64 pod install

Then start your project, npx react-native run-ios

CodePudding user response:

I solved my problem.

/Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected package com.rnstampy; ^ 1 error

this was my problem.

I moved [package com.rnstampy;] on the TOP. that's all. It worked.

  • Related