React Native: Unable to emulate on Genymotion - react-native

I did following command to emulate my react native app on genymotion, but I got an error.
expo start -a
Here is the error.
This computer is not authorized to debug the device. Please 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.

It seems like it might not have been able to find your adb path. You have to install adb and set adb path in genymotion and system.
Open genymotion and go to Settings > ADB tab, select "Use custom Android SDK tools", and point it to your Android SDK directory. And then please make sure that android sdk tools is in your system path.
set PATH=%PATH%;path\to\android\Sdk\platform-tools
Real example on windows, android sdk tools directory path depends on installation directory:
set PATH=%PATH%;C:\Users\<username>\AppData\Local\Android\Sdk\platform-tools
or
set PATH=%PATH%;C:\Program Files\android-sdk-windows\platform-tools

Related

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.

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

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

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.

How can I install a React Native app without releasing it to any store?

I wanna be able to use my app on my iPhone or my Android phone without the need of releasing it to App Store or Google Play Store.
or just use EXPO tools if you are open to using expo development environment for react native
If your project is based on React-Native-CLI and your development environment is all set-up then just run command 'react-native run-android' in the terminal. It will generate a debug apk file which you can be found in the directory:
android > app > build > outputs > apk > debug > app-debug.apk
You can directly install this debug apk in your android phone by connecting the device in the debugging mode and run the above command!
In Xcode, add your Apple ID to Accounts preferences, described in
Adding Your Apple ID Account in Xcode.
In the project navigator, select the project and your target to
display the project editor.
Click General and choose your name from the Team pop-up menu.
Connect the device to your Mac and choose your device from the Scheme
toolbar menu.
Below the Team pop-up menu, click Fix Issue.
Xcode creates a free provisioning profile for you and the warning text
under the Team pop-up menu disappears.
Click the Run button.
Xcode installs the app on the device before launching the app.
Test iOS app on device without apple developer program or jailbreak
For IOS you must have a developer account firstly. And then, you can send your app to itunesconnect and get the app from testflight. Or You can run your ios app on device by using cable. But you dont run your app in developer mode.
For android you just need get the apk from android studio. But some steps there are. Follow this steps for get the apk.
How can I generate an apk that can run without server with react-native?
You can Side load your react native app in iPhone or iPad using Xcode
Open your_projectname.xcworkspace from ios folder in Xcode
XCode - Choose your destination device simulator or device from
Product -> Destination -> Select the device
Create a Temporary provision profile From project Target -> Signing
& Capabilities (Required only for physical device, for simulator don't
require this)
Build and Run your project
React Native's official site has a guide on how to install your app without releasing it.
The tl;dr is as follows:
For ios:
cd AwesomeProject
react-native run-ios
For android:
cd AwesomeProject
react-native run-android

react-native run-android fails, could not install app

I m having a problem when I try to run my react-native application in my Android Device. The device is connected even when I make sure that it is.
adb devices
List of devices attached
HMNBBCE6A2826109 device
Device: Huawei Y2
Android Version: 5.1
Debug mode: enbaled
the server is running.
When i run
react-native run-android
I get this error
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
I had the same problem with my linux laptop.
I ran this inside my app root folder and worked:
chmod 755 android/gradlew
You have to give permission on the android/gradlew.
I found the answer on this github issue
And you must also do this:
Click here to see the all article on the react-native docs page (the place where i get this information).
Configure the ANDROID_HOME environment variable
The React Native tools require some environment variables to be set up in order to build apps with native code.
Add the following lines to your $HOME/.bash_profile config file:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
.bash_profile is specific to bash. If you're using another shell, you will need to edit the appropriate shell-specific config file.
npx #react-native-community/cli doctor
This command checks your environment and displays a report of the status of react-native installation. Check the output carefully for other software you might need to install
I've been struggling with this for a while and in my case (using Windows 10) the solution was to install Java JRE and JDK even though I was already set up with Android Studio.
The problem got clearer when I created a new empty project with create-react-native-app Example and ran it with react-native run-android. The error then complained about JAVA_HOME variable.
Another good tip is to open up your project (located under "android"-folder in your react native project) in Android Studio and see if it compiles.
Good luck!
Try the command.
adb devices
See if there is any devices listed.
If so check the local.properties file inside android folder and check the sdk defined is correct.
if there is no local.properties files. add a new file named local.properties with the following content
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu May 25 18:29:08 IST 2017
sdk.dir=path to sdk
This command will also help
adb reverse tcp:8081 tcp:8081