react-native and Visual Studio Emulator for Android - windows

is it possible to run react native app on Visual Studio Emulator for Android (standalone) and if yes what are the steps to set it up? I can successfully start emulator, that part works but cant figure out how to config react-native to use it instead of "adb devices".
My current attempts end with error:
Could not debug. Error while executing command 'adb devices': Command failed: adb devices
'adb' is not recognized as an internal or external command,
operable program or batch file.
I know about Android Studio and virtual devices that come with it but I would like to try that as the last option. My environment is: Windows 10 pro, VS Code (with React Native Tools Extension), react-native, yarn.
UPDATE
even though I did not get anywhere in my attempts to make it work
I just would like to share what knowledge I gained while struggling with this issue
because it is possible that my issues are specific to my environment but it might work on another PC.
Theoretically it requires very few steps to run react-native in Visual Studio Emulator for Android
in VS code without installing Android Studio or Visual Studio.
Install Visual Studio Emulator for Android, standalone
https://www.visualstudio.com/vs/msft-android-emulator/
download Android Debug Bridge (adb)
it is included with Android SDK Platform-Tools, download and read more here:
https://developer.android.com/studio/command-line/adb.html
it downloads as zip file, you unzip it and then add a path to adb.exe in PATH environment variable,
so you can execute adb command from any path. I am using yarn and it needs that to know where adb.exe is.
It is kind of a connector between your app and virtual or real android device
it has to be running before you start emulator and basic command are:
to stop - adb kill-server
to start - adb start-server
to see list of devices that adb recognized - adb devices
I also found a specific instruction on how to make Visual Studio Emulator for Android work with adb:
https://msdn.microsoft.com/en-us/library/mt228282.aspx
'Visual Studio Emulator for Android' devices are not listed in the Android Device Monitor
it is a registry edit for key
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools
apparently Visual Studio Emulator for Android is using that and you can create it if it is not there
and just add/modify Path variable to be a path to adb.exe.
now you can start Visual Studio Emulator for Android and after that open integrated terminal in you react native VS code project
and type:
yarn run android
and if I get it right (and in the perfect world) your app should get installed and shown in Visual Studio Emulator for Android,
well, not for me, my emulator never shows up as a device when I type adb devices, all I see is a blank two lines.
So I think I spent enough time on this trying to make it work and in my case the answer to my own questions is:
theoretically you should be able to run Visual Studio Emulator for Android with react-native from VS code but in reality
it probably will not work, so seek something more reliable.
I did see a little light at the end of the tunnel when I tried connecting my phone with USB using expo app, adb picked it up right away,
"yarn run android" started doing something and expo even tried to load my app, I held my breath, my heart was racing, I was ready for a miracle... and .... boom... it just crashed, but this could be easier
for me to resolve though, it appears some networking config issues, my phone does not recognize IP address which was in the output after running yarn
and if this works,(big IF) then it is still good, I can run/debug react-native without using Android/Visual Studio.
Final update:
could not make it work, stopped all attempts and went for Android Studio instead, Android Studio emulators work with react native and expo without any issues. (well, not yet, sample app runs OK at least.)

The same symptoms occurred to me when trying to set both React-Native and VS Emulator for Android together, and the following steps solved them:
On the VS Emulator for Android, I checked my emulated phone's IP at the Tools/Network tab. Emulator Adapter #1 refers to the emulated phone.
Then, I headed to the terminal and ran adb connect <ip_address>:5555. That made the emulated phone available to Android Studio as well as to React-Native.

if you already install android studio
then add C:\Users\manu\AppData\Local\Android\Sdk\platform-tools path into environment path (replace your username instead of manu)
if you have not android studio then
need download adb from https://github.com/intel/haxm/releases/download/v7.0.0/haxm-windows_v7_0_0.zip
then install
intelhaxm-android.exe
.
open a new terminal and now adb commnad will work
it is haxm source website https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm

Related

Microsoft visual studio doesn't show any android emulator or physical device for Xamarin project

I have a xamarin project and i want to debug it, but visual studio doesn't show any emulator or physical device.
this is the menu
I wanted to restart adb from tools > android but it's disabled. but when I open a non xamarin project (for example a web porject) this options is enabled.
I can see my device in cmd with command adb devices and in android studio, every thing is fine and I can deploy some java application to my phone.
do you have Any idea?
Update
I created new project and in this new project, every thing is fine and I can debug with my phone or emulators.
but in my existing project which I'm currently working on, there is no device in list.
It happened to me just now using vs 2019, to fix this, manually remove obj and bin folders restart vs, and that's all :)

Android Studio - Error Installing APK + Broken Pipe Error (on Mac)

So I am running Android Studio 3.3 on my Mac that's running High Sierra v. 10.13.4. My code compiles fine and runs on the emulator, but when I try to plug in my 2 Samsung Tab A's that I'm working with, Android Studio throws this error during the build:
java.io.IOException: Broken pipe
Error while Installing APK
Device samsung-sm_t580-5203b3db5aa1b4cfdisconnected, monitoring stopped.`
I've looked around and other people have suggested killing all ADB processes and restarting which I did. I've also restarted my Android Studio and my computer and the tablet. And it seems that the Android studio can find the tablet as it pops up on the ADB device listing, but just can't connect to it. I also saw something about Eclipse and Android studio running concurrently and causing issues, but I don't have Eclipse running so it can't be that either. However, when I tried my roommate's Android phone (Pixel XL 2), that works fine and the code builds and runs on the phone.
So at this point I'm a little baffled at why I'm having this issue. Any thoughts or suggestions would be awesome!

how to add windows phone emulator to the uwp project

Now I'm updating someone's UWP project.
I use Visual Studio 2017 on windows 10 64bit.
Building is successful.
But When I run this project, I got an error.
DEP6200: Bootstrapping failed.Device cannot be found.
SmartDeviceException - Deployment failed because no device was
detected.
I think, the reason is that I didn't use real windows phone.
So that I wanted to use windows phone emulator.
But I don't know how to add emulator to running option.
When I created new UWP project, I could find emulators which are connect to that project.
Anyone solved this issue?
You have to install Emulators.
Please take a look at this page and download them Windows Emulator archive .
Simply choose your emulator version that you want to debug your app and then Click INSTALL EMULATOR , After installation Restart Visual Studio .
To use emulator there are some prerequest, you can check it from here.
That's to say, first ,you need to make sure you followed the system requirements.
Then you have to install emulator like MKH said. And at last, set the CPU to ARM and choose the emulator you need, run the project and you will see the result.

DEP3316 Error - Cannot deploy to Win10 Phone from Visual Studio 2015

I am unable to deploy an application via Visual Studio 2015 Update 2 to my Lumia 650. In the past it was possible but now I get the following error indicating to change the build configuration of a project or add an ARM device.
The build config is set to 'ARM', the device is connected via USB and my configuration manager looks like this.
The platform targets seem correct, so the config setting 'ARM' points to the platform target 'ARM'. I can run the app on my local computer, but I cannot deploy it to my phone. I also can't run the app in an emulator because if I choose the setting, VS does not change the caption and accept it. I don't have any more ideas.
If it helps I could provide my .sln file with all build configurations if desired. The only thing I did was checking out my source code to a new location on my hard drive. Since then I couldn't deploy anymore. Someone got any hints?
UPDATE:
I cannot deploy to my phone, run the app in an emulator or run the app in the simulator. The only thing that works is running on the local machine. Even all new apps I create cannot be deployed or run in an emulator or simulator. Visual Studio and SDK repair installation was made, no notable change.
If I load an old Windows Phone 8.1 RT or Silverlight project everything works normally, I can use the emulator and I can deploy it to the phone.
Right click your app in VS -> Properties -> Debugging
There is a combo box to select the target device. In my case there was no selection and I chose 'Device'. Now it works again.
https://dotblogs.com.tw/billchung/2016/04/03/051455

Why does visual studio 2013 run adb.exe when I try to debug using an android device?

I have a Sony Xperia Z3 and I'm trying to debug an Apache Cordova application aka: Multi-device hybrid application on my device but visual studio builds and then opens adb.exe after the build is complete. It doesn't launch the application on my device although my device does prompt for verification.
I have developer options enabled on my device and I have USB debugging enabled.
I followed the steps on MSDN to debug an application on my device but it still doesn't work: http://msdn.microsoft.com/en-us/library/dn757059.aspx
I created a self signed keystore using the keytool in jdk and that works fine.
I have all of the necessary drivers installed and my device appears under the "adb devices" list of connected devices.
I tried deleting all the drivers and reinstalling them as well as updating them.
The ripple emulators work perfectly. It's just when I try to debug on a device.
well, that's a known issue with Cordova visual studio 2013 update. please see below blog for the known issue list for Cordova and search for adb on page. you'll get to know about this and there is no fix available for till now. please update me too if you find any :)
I'm pretty sure that you CANNOT debug a cordova visual studio project in an android DEVICE! The ripple emulators also are very limited, some plug-ins just simply DON'T work in the emulator!

Resources