AVD emulator opens previous expo project instead of current - react-native

I am attempting to run my expo project on an Android virtual device.
I start by doing a
expo start
Then I open AVD Device manager and launch a device. Here I am getting an error "unable to locate ADB", but it still starts.
Finally I go to the web browser window that expo start had opened and click "Run on Android device/emulator"
The emulator then opens an older project instead of my existing project. What am I doing wrong? How can I open the existing project instead. That same browser window allows me to launch on my actual phone using the QR code and opens to the correct project.

I ended up clearing expo app cache in the emulator and this addressed the issue.

Related

“launchPackager.command” can’t be opened

Just updated my Mac to the official release of Ventura, and I cannot launch my application via react-native run-ios.
Expected behavior:
running react-native run-ios will launch an Xcode simulator and a terminal window with Metro running.
Current behavior:
Xcode simulator opens, main terminal says app was built successfully, but an error is thrown instead of the metro terminal opening:
“launchPackager.command” can’t be opened because (null) is not allowed to open documents in Terminal.
The simulator just shows a white screen and can't be interacted with.
What I've tried:
manually opening node_modules/react-native/scripts/launchPackager.command
opens Metro terminal but is not connected to the app
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
info Reloading app...
giving Terminal full disk access (no change)
This happened to me after upgrading to macOS Ventura. I happen to use iTerm as my main terminal, not the built-in Terminal.app so the following fix only applies to that scenario:
Set iTerm as the Default Handler for *.command Files
Open node_modules/react-native/scripts/ in Finder (open node_modules/react-native/scripts/)
Right-Click on launchPackager.command and click Open With then choose Other...
In your Applications directory, select iTerm and click Always Open With
After this, you might need to run npm run ios again from this terminal window. However, from now on, Metro will open in a new iTerm tab instead of trying to open the command in a new Terminal window.
For me, this was the desired behaviour and it removed this warning.
Note In future, any *.command files will now open with iTerm instead of Terminal.
I encountered the same problem as you, I installed another terminal (iTerm2), then randomly found a .command file, and in the display introduction, changed the default opening method to iTerm2enter image description here
I'm having this issue after upgrading my MacOS to Ventura 13.1.
If you don't want to use iTerm as the accepted answer suggest, the workaround I found was to look for the launchPackager.command file inside node-modules/react-native/scripts/ and open this file manually every time you run your app for the first time (specifically when the error pop-up appears). This will open the terminal with metro running already.
I know that manually processes are not the best, but I don't want to use iTerm :)
Using Intel version of apps (Webstorm, Android Studio, other IDE etc...) fixed my problems. I encountered the same issue and thanks to Intel version of Webstorm and Xcode on Rosetta I can able to pod install and other operations.
Note: I'm using Intel version of Android Studio, WebStorm. Also Xcode uses Rosetta 2. No problem detected and everything works perfect. I can able to develop React-Native & Native Android & iOS and Flutter apps without problem. Before that I was using Silicon version of WebStorm and almost no function worked.
Config: MacBook Air, macOS Ventura 13.2 on Apple M1 processor.
For Most of the case you just have to delete node_modules and install modules again (npm i). This happens when project was copied from old mac which had node_modules folder created by the old user, or if the system thinks so
This happened to me after i configured my terminal for the look and feel - but with iterm2, oh my zsh, and powerlevel10k

Couldn't start project on Android: It took too long to start the Android emulator: Pixel_2_API_30

To run my react native application, I try to create & run an emulator in android studio and get this error every time.
Couldn't start project on Android: It took too long to start the Android emulator: Pixel_2_API_30. You can try starting the emulator manually from the terminal with: C:\Users\ASUS\AppData\Local\Android\Sdk/emulator/emulator #Pixel_2_API_30
You must wipe the data. For that go to Device Manager -> Wipe Data. After that restart your Android Studio. Then after your issue may be solved. Have a look on below mentioned image to get a better understanding.
Try clear your device cache data
Android studio -> virtual device manager -> on device actions select wipe data and then cold boot every-time
This is works for me,
If you run your project on VS Code, don't let automatically Emulator start after pressing a (run on android)
What I did is, I install VS Code Android Ios Emulator Extension and, I opened the emulator first through the VS Code.
After that, you can run "npm start" and press a to run the app on the emulator!!!

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.

Switching between Expo Apps Running on Android Emulator

I am sorry for the trivial question!
While testing an Expo (react-native) app on Android Emulator, I need to switch to other apps, e.g. to the Contacts Manager to add a contact. Then, I need to go back to the Expo app to test something. How can I do that?
I tried the following.
Start the Expo app and play with it
Press the Home button
Start Contacts Manager
I could NOT find a way to start the Expo app again. I found an Expo icon in the list of apps. When I clicked on it, a screen with everything disabled, except "Open from Clipboard" appeared. The "Open from Clipboard" option seems to be for switching between different Expo apps. Anyway, when I clicked on it, I got the following error message.
Something went wrong. Could not load exp://switching/%20between%20Expo%20apps%20running%20on%20Android%20Emulator.
Environment:
Expo: 32.0.0
Android Emulator: API: 25 - Android 7.1.1 x86 - Nexus S
Thank you for your effort and time to help...
Are you using a connection localhost? if yes, on the terminal, try to press 'a'.

ERROR : Invalid "--device-id"

I am facing a problem while running my app from titanium studio. my previous app was running properly but i created new project and then when i try to run my app, it says
[ERROR] : Invalid "--device-id" value "AVD"
For help, run: titanium help build
[ERROR] Application Installer abnormal process termination. Process exit value was 1
here AVD is my android virtual device name. my device is running properly.
Possible reasons and solutions
Bug in the Android SDK
There was a bug in the Android SDK which is already fixed. The fix was released with Android SDK-Tools 22.6.2. Here are some more information from the Appcelerator Bugtracker.
The (real) device doesn't trust your computer
The USB-Debugging is active on you device, so It is displayed in the device list, but the device doesn't trust your computer. To fix that unplug the device and plug It again. Wait for the trust this computer dialog and click ok.
Corrupted / Wrong "run config"
Sometimes it happens that the run configurations gets corrupted or you have added a wrong one. In this case you can delete the configuration under "Run Configuration":
Click the arrow with the current device
Click on "Run Configuration"
Select the not working configuration (e.g. under Titanium Android Emulator)
Click on the red "X" Close the dialog
and "run" the device again