React Native project dont run on a android emulator (android studio) - react-native

I have made android emulator and other things properly but nothing really works for me. It says,
Couldn't start project on Android: The system cannot find the path specified
I am using windows 10 as operating system.

I also had the same problem.
check your ANDROID_HOME variable in advance system setting.
It must point to your SDK: C:\Users\$USER_NAME\AppData\Local\Android\Sdk

Related

Failed to intall the app in react native, how can I fix this?

I was trying execute myapp to android but an error occurred.
To clarify what happened, first time I install nodejs and Android Studio.
Later I used the following commands:
npx react-native init 'app'
cd app
npx react-native run-android
Its my fisrt time messing with react native, I was following this page:
https://learn.microsoft.com/pt-br/windows/dev-environment/javascript/react-native-for-android
And the error is:
The error
I want coding in real time for android app.
How can I fix this?
Looks like the terminal output gives you several steps to do/check.
Make sure you have properly set up your android environment. Use this link to do so. You can use Expo-Cli or React-Native-Cli.
SDK location not found. This could be an off-shoot error of not properly doing step 1. However, to cover all of your bases, ensure you have properly set up your Android Emulator. This doc is a great walkthrough.
Once your Android studio and AVD Manager is properly set up, and your development environment is properly set, you should have no issues!
Please let me know if doing the above to steps did or did not solve your errors.
If you follow the steps, https://reactnative.dev/docs/environment-setup and https://developer.android.com/studio/run/emulator there will be no problem.
As a React Native fan on Windows 10, I'd like to mention just few points you need to check.
First, please check following user variables in Environment Variables ( You can see it from System Properties).
adb="C:\Users{username}\AppData\Local\Android\Sdk\platform-tools"
ANDROID_HOME="C:\Users{username}\AppData\Local\Android\Sdk"
JAVA_HOME="C:\Program Files\OpenJDK\openjdk-11.0.15_10"
Path: check if contains {ANDROID_HOME}\platform-tools
Eg:"C:\Users{username}\AppData\Local\Android\Sdk\platform-tools"
Second, if you are using Android Sdk emulator, please make sure that it configured correctly in emulator list in Android Studio.
For an instance, I created a android emulator using android sdk-29 and you can check the followings.
Third, I recommend you, deploy first app on emulator in Android Studio.
Because we need to download gradle zip file and others, it's essential to run your first android app in Android Studio.
When you confirmed your first android app(Deploy empty project app is also okay), you can run your React Native App by Expo-cli or react-native-cli.

Expo-react-native :Couldn't adb reverse: device 'adb' not found

I am using react-native-expo for mobile app development.
I use an android emulator for the app, vscode editor for development.
It started showing me this error from few days.
› Opening on Android...
Couldn't adb reverse: device 'adb' not found
› Opening exp://10.0.46.81:19000 on Device adb
Couldn't start project on Android: Error running adb: device 'adb' not found
› Press ? │ show all commands
I tried wiping the emulator, tapping on the build number in the emulator, but nothing worked out.
I've deleted the virtual devices and created new one. It worked for one time and again this process isn't working.
there isn't much about this on the internet.
need help.
Just try this. It is work for me.
make sure you already add android sdk path in setting > appearance & behavior > system settings > android SDK > android SDK location
(Common path is C:\Users(name)\AppData\Local\Android\Sdk)
create new variable name and value in Environment Variables (User Variables)
(ANDROID_HOME C:\Users(name)\AppData\Local\Android\Sdk)
add new Path in Environment Variables (User Variables)
(C:\Users(name)\AppData\Local\Android\Sdk\platform-tools)
It is work for me after I have solved it for 3 hours.
At first, I don't face the problem like this in flutter but in react-native.
The fix for me was to install the SDK Platform for the android version used by the AVD.
In my case, I installed android v9 (Pie) via the AVD Manager when setting up my AVD for the first time, and when I looked into this issue I noticed that the SDK Platform for v9 was not installed as part of that setup.
The exact steps I took are as follows:
Disclaimer: You might not need to follow these steps exactly to resolve the issue
Close all CMD and IDE programs.
Open Android Studio and navigate to AVD Manager
Click the down arrow for the target AVD and click the Edit option
Set the device to Cold boot instead of Quick boot
Open SDK Manager, and download the SDK Platform for android version used by AVD
Go back to AVD Manager, click the Cold boot now option
Open a CMD terminal as administrator, CD to project repo, and run expo start
Launch expo in AVD
DONE
I had the same problem. Emulator started working after this:
Delete caches from Android Studio
Wipe data from your emulator
Cold boot to restart
When I was solving this problem I also ended up doing these:
Check Android studio updates
Reinstalled Android studio
Check SDK updates from SDK tools: SDK Manager -> Android SDK -> SDK tools. You can see if there is a new update available on the right.
Go to Virtual Device Manager -> Select your Device -> Actions -> Click "Drop down" button and select "Cold Boot Now".
This worked for me.
For my case, I went to the avd and simply clicked "wipe data", restarted both my avd and server and it worked
By my side the problem was is In Internet Connection. I just changed the WiFi and everything working fine.

AVD Manager: unable to locate adb in android studio

I'm just starting out my react track and thought of a little react-native app. Well, I installed Android Studio, the SDK and all that I needed according to https://reactnative.dev/docs/environment-setup, using the react-native CLI tab. But when I try to launch my emulator for any device on my list I get the error: AVD manager unable to locate adb. I have checked my %ANDROID_HOME% variable and it's set to the correct Sdk dir, I can use adb.exe inside the platform-tools dir with no apparent problem. But the AVD manager can't.
I even tried reinstalling Android SDK after deleting the platform-tools dir, or even installing a different version of it, but it just won't work!
Any thoughts on what is happening?
I struggled with this problem for a few days now and the number 1 suggestion I found is:
review your environment variables (such as %ANDROID_HOME%);
remove the platform-tools dir inside %ANDROID_HOME%, adb.exe is either corrupted or missing;
reinstall Android SDK and check for adb.exe inside %ANDROID_HOME%\platform-tools;
emulate a new device (you are a wizard Harry!);
Well, this didn't work for me but apparently worked for some people, especially for avast users (apparently it corrupts adb.exe 'cause it believes it to be malware).
What worked for me was:
In Android Studio go to File > Project Structure (Ctrl + Alt + Shift + S in windows);
Under Project Settings>Project>Project SDK must have a valid Android SDK selected;
emulate a new device (you are a wizard SadSack963!);

Could not install the app on the device (react)

I trying to run the react-native run-android through my React Project. After that,
I got this error
If you are installed sdk correctly, you can create an empty file in your android project named "local.properties" (if it does not exist) and define sdk address in it like this:
sdk.dir=/home/USERNAME/Android/Sdk
This address may changes based on your settings, it's the default address in linux.
I hope it helps you
I assume that you are using windows.
Add an environment variable ANDROID_HOME that points to
C:\Users\<your-user-name>\AppData\Local\Android\Sdk
You must follow the steps described in the URL:
https://facebook.github.io/react-native/docs/getting-started.html
go to Building Project with native Code and follow the steps and you must have a virtual or real device for testing. To check if any device is connected or not just go to your terminal and type adb devices and if there is any device it will show.

Appcelerator/ Titanium Alloy - No Andriod SDKs were found under the specified SDK Location

I am running Appcelerator on OSX.
When I try to set up an emulator on the Appcelerator IDE, by clicking:
"Run Configurations..." >
"Appcekerator Android Emulator - appname" >
"Emulator"
On the bottom of the screen it shows up with an error message saying:
Problems detected with the SDK settings. Click here for details
Upon clicking for more details, it shows the error message:
An error was detected with the SDKs configuration
Reason:
[Android SDK Home] No Android SDKs were found under the specified SDK location
The value i have put for Android SDK home was:
/Users/username/Library/Android/sdk
How do I solve this issue?
Instead of using the Emulator which are slow and heavy in terms of Memory Usage, I would suggest you to use the GenyMotion for Android which is quite fast and easy to use and has close features to a physical device.
But First this First, setup the Android SDK for Appcelerator through Preference > Platform > Android and browse the Android SDK folder and Android NDK.
Note : This can be anywhere in the system folder.
You can download the GenyMotion Tool from the below link : https://www.genymotion.com/fun-zone/
Setting up the tool is quite simple and is given in the image itself.
Good Luck, Cheers
I had the same problem as above. I did move my Android SDK home out of '~/Library/' folder.
Previously it was:
'~/Library/android-sdk-macosx'
Then i moved it like:
'~/android-sdk-macosx/'
Most probably, the Library folder not visible to AppceleratorStudio. My guess.
Thanks a lot, guys.