Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

Viewed 3796

MacBook-Air mlaapp % npx react-native run-android warn The following packages use deprecated "rnpm" config that will stop working from next release: - react-native-video: https://github.com/react-native-community/react-native-video#readme Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide. info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 1232 file(s) to forward-jetify. Using 4 workers... info Starting JS server... info Installing the app...

FAILURE: Build failed with an exception.

  • What went wrong: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

  • 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 1s

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

FAILURE: Build failed with an exception.

  • What went wrong: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

  • 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 1s

at checkExecSyncError (child_process.js:631:11)
at execFileSync (child_process.js:649:15)
at runOnAllDevices (/Users/varmabiraju/projects/Joshi/MyProjects/mlaapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at buildAndRun (/Users/varmabiraju/projects/Joshi/MyProjects/mlaapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:179:41)
at /Users/varmabiraju/projects/Joshi/MyProjects/mlaapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:133:12
at processTicksAndRejections (internal/process/task_queues.js:88:5)
at async Command.handleAction (/Users/varmabraju/projects/Joshi/MyProjects/mlaapp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:182:9)
4 Answers

Try changing sdk versions in /android/build.gradle

compileSdkVersion = 30
targetSdkVersion = 30

from the comments, it seems that you are not using the gradle version 6.3. can you update your android build to use gradle 6.3 and see if the issue still persists?

another user faced a similar issue and reported this on github. you may want to take a closer look at it here.

This worked for me: Open task manager (of your OS) and kill adb.exe process. Now start adb again, now adb should start normally.

If this is your error

error for nativeDevServerPort

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

gradle 6.2 all zip causing this error for run-android please change or upgrade the distributionUrl version of gradle in

gradle-wrapper.properties to

distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip

Hope this could help you in installing your react-native application in android

Related