blessing Jackson
blessing Jackson

Reputation: 63

how can I fix "build failed" after I run react-native run-android in windows 10

I have created the project very well and I have also installed the android studio and all the required sdks. but still I am still facing a problem of the emulator not starting. below is error in the terminal.

'$ react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. (node:8368) 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 866 file(s) to forward-jetify. Using 6 workers... info Starting JS server... 'adb' is not recognized as an internal or external command, operable program or batch file. 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... Starting a Gradle Daemon, 3 stopped Daemons could not be reused, use --status for details

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.2/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE: Build failed with an exception.

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\jayde\Desktop\KYC\Zipcomply\android\local.properties'.

BUILD FAILED in 38s

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.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\jayde\Desktop\KYC\Zipcomply\android\local.properties'.

BUILD FAILED in 38s

at makeError (C:\Users\jayde\Desktop\KYC\Zipcomply\node_modules\execa\index.js:174:9)        
at C:\Users\jayde\Desktop\KYC\Zipcomply\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (C:\Users\jayde\Desktop\KYC\Zipcomply\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\jayde\Desktop\KYC\Zipcomply\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:192:9)

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

Upvotes: 2

Views: 6902

Answers (4)

Kalkidan Bekalu
Kalkidan Bekalu

Reputation: 21

Change the ANDROID_HOME Variable name To ANDROID_SDK_ROOT or create one if it doesn't exist already.

  1. Browse to C:/Users//AppData/Android/SDK
  2. Copy the path from the explorer
  3. Hit START and type "environment variables" [ScreenShot][1] [1]: https://i.sstatic.net/o6b5G.png
  4. Look for a button which says environment variables and click it
  5. click "New" variable under either user variables or system variables.
  6. paste "ANDROID_SDK_ROOT" in the variable name field and
  7. SAVE and Restart Your PC if needed.

-----------------------DONE------------------------

Upvotes: 0

Apps Maven
Apps Maven

Reputation: 1420

Check Your SDK path and you have installed correct sdk according to version.

Upvotes: 0

displayname
displayname

Reputation: 1074

Have you tried this?

  1. Go to your React-native Project -> Android

  2. Create a file local.properties

  3. Paste

C:\Users\USERNAME\AppData\Local\Android\sdk

  1. Replace USERNAME with your user name

Upvotes: 0

ZFloc Technologies
ZFloc Technologies

Reputation: 4635

ANDROID_HOME is Deprecated (in Android Studio), use ANDROID_SDK_ROOT instead.

Configure the ANDROID_SDK_ROOT environment variable

  1. Open the Windows Control Panel.
  2. Click on User Accounts, then click User Accounts again
  3. Click on Change my environment variables
  4. Click on New... to create a new ANDROID_SDK_ROOT user variable that points to the path to your Android SDK:

The SDK is installed, by default, at the following location:

%LOCALAPPDATA%\Android\Sdk

You can find the actual location of the SDK in the Android Studio "Settings" dialog, under Appearance & Behavior → System Settings → Android SDK.

Upvotes: 1

Related Questions