Expo can't connect to android-studio emulator (Ubuntu 20.04) - react-native

When I run "npm start" and then 'a'/ "sudo expo start --android" the connection to the android emulator fails.
the error I get is:
Couldn't start project on Android: Error running adb: No Android connected device found, and no emulators could be started automatically.
Please connect a device or create an emulator (https://docs.expo.io/workflow/android-studio-emulator).
Then follow the instructions here to enable USB debugging:
https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK directory.
While trying to debug it I found:
The app is running on web browser
While launching the AVD on emulator on android-studio I get on android studio events:
Emulator: E0810 10:41:04.480101550 89662 socket_utils_common_posix.cc:201] check for SO_REUSEPORT: {"created":"#1597045264.480085451","description":"SO_REUSEPORT unavailable on compiling system","file":"/mnt/tmpfs/src/android/emu-master-dev/external/grpc/src/core/lib/iomgr/socket_utils_common_posix.cc","file_line":169}
I Made sure that .bashrc includes the right SDK path: "export ANDROID_SDK=/home/user/Android/Sdk", and followed this link
I'll mention that the emulator already ran my app, I'm not sure what changed the configuration and made the app not running on android-studio emulator. I re-install android-studio but it's still have no connction

Related

After updating to Expo SDK 41 from Expo SDK 40, Android Studio won't start emulator

I go to start emulator on my mac m1 and it'll bring up the phone emulator however my project is not uploaded to the phone.
I am getting this error in the terminal:
› Opening on Android...
› Opening emulator Pixel_5_API_33
› Opening exp://172.16.100.190:19000 on Pixel_5_API_33
Couldn't start project on Android: Error running adb: adb: failed to install /Users/me/.expo/android-apk-cache/Exponent-2.19.7.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
› Press ? │ show all commands
This download is taking longer than expected. You can also try downloading the clients from the website at https://expo.dev/tools
⠦ Installing Expo Go 2.19.7 on Pixel_5_API_33
The ios emulator seems to be working fine
I just solved this issue for myself, it appears your emulator doesn't have enough storage assigned to it.
Here's how you can increase the storage on your emulator
For my emulator I increased the device Internal Storage to 8GB and enabled No SDCard. This has allowed me to emulate my expo react-native app on Android while running on my M1 silicon chip MacBook.

Windows 10 WSL2 expo cannot find simulated android device from Android Studio

I am new to android development and am trying to learn react-native by following a tutorial here. The problem is whenever I try to start my react-native project within my simulated android device, expo cli cannot find it. This step is at the 25 minute mark of the video and my progress can be summarized as follows:
I have react-native on my machine and have installed expo cli
I've downloaded Android Studio which is located: C:\Users..\AppData\Local\Android\Sdk
I have my emulated android device up and running via Virtual Device
Manager
After typinng "npm start" When I type "a" within the terminal of WSL to run this app on my virtual android device I get the following message when it tries to open the emulator:
No Android connected device found, and no emulators could be started
automatically. Please connect a device or create an emulator
(https://docs.expo.dev/workflow/android-studio-emulator).
At which point my expo developer tools browser window displays that
Expo Developer Tools is disconnected from Expo CLI. Use the expo start
command to start the CLI again
When I goto the terminal and do this, it just restarts this failure over again when I type "a" to start my app in the simulated android device. Some of the solutions I've tried are:
following the documentation on the workflow android studio emulator link. I find though that all of the options within my version of android studio look drastically different, and that my file location is much different than what they have listed.
uninstalling and reinstalling Android Studio
Making sure SDK tools is checked as per this stack overflow post
following the instructions in this stack overflow post, however I am not trying to connect a phone via usb so this does not help me.
My setup is as follows:
OS: Windows 10
VM: WSL2 Ubuntu 20.04.3 LTS
Text Editor: Visual Studio Code 1.63.2
Android Studio: BumbleBee 2021.1.1
Expo CLI version: 5.0.3
here are some screen shots:
^ that one is right before I try to type "a" within the expo cli within terminal.

APK of react-native app shows blank screen

I have built a react-native app which works perfectly fine in development, but when I generate the APK with expo build:android, it doesn't work. If I load the app on my android device, the splash screen is displayed for a few moments and then it just shows a blank screen. I am unsure how to check what the error is when using the apk. How do I do so?
The issue could be with the SDK version. Check your device API level and the SDK version your building with.
You could set up a ADB (Android Debug Bridge) and install the apk onto a device/emulator. There you have a number of options for debugging.
Edit:
If there isn't any android specific code that uses the API then you can ignore what I said before.
Uninstall the app on your device. Settings > Apps > [Your App] > Uninstall
In your development run 'expo start'
If dev is working, then run 'expo start --no-dev --minify'
If that works then you can build 'expo build:android'
Install apk on your device || with ADB preferably
Information need for further troubleshooting:-
Device Version [Found on device Settings>System>About]
Expo SDK [Found in app.json]
ADB logs

expo cli and ADB error: can not connect to daemon

I am trying to get expo CLI and ADB working on my PC (Win 10 64bit) with the Genymotion emulator Google Pixel 3.
When I run "on android device/ emulator from expo cli" I get the following logs:
Couldn't start project on Android: Error running adb: No Android device found. Please connect a device and follow the instructions here to enable USB debugging: https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK directory.
See this image
I am already install latest verson of Virtual Box, genymotion emulator and properly install expo in my "c:\repos" now when I click run on emulator from expo cli I get this error. sdk manager is already install in my c:\ and in genymotion settings I setup this path in adb : "C:/Program Files/Genymobile/Genymotion" and it's show this folder is valid.
Error occurred because the current computer and emulator are not connected.
Did you set up the Genymotion as described in the error?
If you hadn't, go to Settings -> ADB, select "Use custom Android SDK tools" ->
and point it at your Android SDK directory.
/Users/username/Library/Android/sdk
Run emulator, click developer options, enable USB debugging and enable Wi-Fi to Cellular.
Run the Genymotion Shell and type devices list to find the IP address of the device.
Open the terminal and enter adb connect deviceIp:5555. Make sure the connection to adb device is correct. Enter adb usb and adb tcpip 5555.

React Native Not Running projects that I copied from Windows machine to Ubuntu

I just moved to Ubuntu from Windows 10, I have installed react-native on my laptop and everytime I do react-native init it creates a project as expected. react-native run-android & react-native start commands are working as you'd expect them to be.
My main problem is I just copied a react native project from my Windows 10 machine to Ubuntu and now everytime I do react-native run-android This is the error I see on my console
This is the error I see on my console
Starting JS server...
Running /home/adeel/Android/Sdk//platform-tools/adb reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...
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/android-setup.html
The problem was the React Native project was created in Windows and I was trying to run it in a Linux based platform. So what I did was I created a brand new project in my Linux environment and copied my RN code in the newly created project.
This was I believe due to the android file it created which is platform dependent. Windows and Linux have different GRADLE files. I hope this helps anyone who is having this issue.
Seems like it is not recognizing your device/emulator. Run "adb devices" to check. I guess you did the whole Android setup and installed Android Studio (SDK).