John Valdetine
John Valdetine

Reputation: 446

"Command failed: ./gradlew installDebug" Problem (react-native run-android)

I have a problem while working on React Native project in macOS platform. My project is working correctly on IOS Simulator but did not work on Android Emulator.

Here is the error log:

JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

> Configure project :app
WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Task :app:checkDebugClasspath FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find react-native.jar (com.facebook.react:react-native:0.58.4).
  Searched in the following locations:
      file:/Users/asena/Desktop/deneme/Deneme/node_modules/react-native/android/com/facebook/react/react-native/0.58.4/react-native-0.58.4.jar

* 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
1 actionable task: 1 executed
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

Command failed: ./gradlew installDebug

Error: Command failed: ./gradlew installDebug
    at checkExecSyncError (child_process.js:637:11)
    at Object.execFileSync (child_process.js:655:13)
    at runOnAllDevices (/Users/asena/Desktop/deneme/Deneme/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
    at buildAndRun (/Users/asena/Desktop/deneme/Deneme/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
    at isPackagerRunning.then.result (/Users/asena/Desktop/deneme/Deneme/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

How can i fix this problem? What's your suggestion?

Thanks,

Upvotes: 3

Views: 12875

Answers (1)

Kai
Kai

Reputation: 2599

You probably just have a different version of React Native installed.

The quick and dirty fix is to just change the version to "com.facebook.react:react-native:+".

What might be better is to go into your node_modules, find the actual package version, and change the version in your gradle script to match.

Upvotes: 1

Related Questions