Getting Cordova/Phonegap to emulate on Genymotion virtual device - node.js

Using the Cordova CLI, I set up an app and build it:
cordova create hi com.example.hi Hi
cd hi
cordova platform add android
cordova build android
I run Genymotion and start a device named "api9". I run the Android Debug Bridge adb devices and it shows as
192.168.8.101:5555
I try to launch the app with cordova emulate android but I get:
Error: An error occurred while emulating/deploying the android project. ...spawn ENOENT
However, launching the Android Virtual Device manager and starting an emulated device; the cordova emulate android works and adb devices lists;
192.168.8.101:5555
emulator-5554
What should I do to make Cordova emulate through Genymotion devices?

It seems that adb sees genymotion virtual device as a real device and not as an emulated one, try cordova run android instead of cordova emulate android.

When the device list is empty, which is not covered in this case, then you need to connect adb manually to the genymotion device.
Therefore you have it run in the same JAVA SDK environment so don't use the inbuilt one in Genymotion.
Then start up your device. On screen should appear some genymotion icon. Click it and you will see the IP.
Use then in the console the command "adb connect 198.123.123.123" (use your own IP of course).
After that your device list is updated.
Finally use "cordova run android" and it will install your app to the virtual device.
Same applies also for ionic framework: "ionic run android".
Caution: without any device found it will fallback to emulator...

Related

The Android studio recognize my samsung s22 phone but will not run an app via usb debugging

I have recently installed the Android Studio Dolphin | 2021.3.1 Patch 1 on a Fedora Linux OS and when I tried to run my first app on the physical device via USB debugging I noticed that the app will not run on my Samsung S22 device even the Android studio recognize my device and does not throw any error.
So when I click on the run app button the Android studio starts the build process and finishes the same process, but after the build process, the same app will not install and run on my phone.
So what is the problem?
Here is the screenshot:
Here is the screenshot of my SDK manager:

No connected devices found; please connect a device, or see flutter.io/setup for getting started instructions

i am using the Android Studion 3.3 on Windows 10. i have created a emulator and it is running manually for the AVD manager but when i Click on Run Button the fallowing messageBox sappers
> No connected devices found; please connect a device, or see flutter.io/setup for getting started instructions.
I would try to restart your adb deamon first. Adb is the program that runs in the background to install your application to the simulator. You can do that by using the following command:
adb kill-server
Then you can run adb devices. If should start adb again and if it shows your emulator, it means that the simulator is sucessfully connected to adb, which means you are ready to try to install the application again from Android Studio.
If that still does not work, you can also restart Android Studio and the emulator, which often solves this kind of problems for me. (It's also useful if you run flutter doctor, it will tell you if any devices are connected).

Android device recognized by adb but not recognized by Chrome development tools

I have an Android device recognized by adb devices but not recognized by chrome development tools (with or without discover USB devices checked).
My machine development is a Mac and I have
installed Android Studio 3.1
Installed SDK platforms Android 8.0 and 8.1
Installed SDK Tools: Android SDK Build-Tools 28 rc-2, Android emulator, Android SDK platform-tools, Android SDK tools, Intel x86 emulator, Android support Repository and Google repository
If disconnect and reconnect the cable, or if I switch on/off the USB debugging on my device makes no difference.
ADB kill-server / start-server don't produce any reaction in Chrome.
Apparently adb is working properly
I've already changed android development environment, from android studio to brew cask version (android-sdk, android-ndk, android-platform-tools) and vice-versa with no success (similar results).
I have reinstalled Chrome
Currently I have android studio and in my ~/bash_profile I have set:
export ANDROID_HOME=/Users/${USER}/Library/Android/sdk
#export ANDROID_SDK_HOME=/Users/${USER}/Library/Android/sdk
#export ANDROID_SDK_ROOT=/Users/${USER}/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$ANDROID_$
export ANDROID_ADB_SERVER_PORT=5038
This problem started a coupled of days ago. Previously worked fine for months. Not sure what led to the problem, but I made some trials with ionic dev app (not sure on any cause-effect) and some time after my development environment started with problems.
My problem is I cannot have remote debug with Chrome. I can deploy my ionic application into my connected mobile and run it, but not debug the development
Debugging with emulator is not efficient in my case since I use physical components such as scanning and photos
Any help help is more than welcome. I've spent hours with this ...

Can't run react-native project in a physical device instead of emulator?

I installed Android Studio and also I have an emulator in AS.
I started new react native project and I running successfully on emulator.
This process was successful.
But
I just connected my new device to Android Studio and selected Deployment target also
But I don't know what to do next. But from my knowledge I tried to react-native run-android in my terminal, but it shows
FAILURE: Build failed with an exception. 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
So can't run the project in device.
Please help me to do next steps.
Enable Debugging over USB
Most Android devices can only install and run apps downloaded from Google Play, by default. You will need to enable USB Debugging on your device in order to install your app during development.
To enable USB debugging on your device, you will first need to enable the "Developer options" menu by going to Settings → About phone and then tapping the Build number row at the bottom seven times. You can then go back to Settings → Developer options to enable "USB debugging".
Plug in your device via USB
Let's now set up an Android device to run our React Native projects. Go ahead and plug in your device via USB to your development machine.
Now check that your device is properly connecting to ADB, the Android Debug Bridge, by running adb devices.
$ adb devices
List of devices attached
emulator-5554 offline # Google emulator
14ed2fcc device # Physical device
Seeing device in the right column means the device is connected. You must have only one device connected at a time.
Run your app
Type the following in your command prompt to install and launch your app on the device:
$ react-native run-android
If you get a "bridge configuration isn't available" error, see Using adb reverse.
Hint
You can also use the React Native CLI to generate and run a Release build (e.g. react-native run-android --variant=release).
Make sure to shutdown the emulator and only have one device connected.
Read further here :- https://facebook.github.io/react-native/docs/running-on-device.html
You have to run tcp command in platform-tools in command line for connecting your mobile.

Genymotion works well, but start Android Studio Plugin show error: 'unable to start VirtualBox'

I've installed Genymotion and VirtualBox on ubuntu 16.04 LTS and everything goes fine. Genymotion works well.
Then I installed Genymotion Android Studio Plugin,but when I clicked 'start', it shows: unable to start VirtualBox
Run Genymotion directly it works well, but Android Studio Plugin goes error,It is not like this: Genymotion error at start 'Unable to load virtualbox',how to fix it?
Watch this,run genymotion directly works well, but run android studio plug it shows: 'unable to start virtualbox.'
Open Genymotion -> Settings -> ADB -> Use custom Android SDK tools -> locate your SDK.
You have to use the Genymotion SDK as that of Android studio.Try it hope it helps !!
If you don't have geni virtual box installed, install it.
Your error says that you don't have your virtual box installed in your PC .
If you have then you have not given the right path click on geni icon and set path of it where You installed
(by default its like /Applications/Genymotion.app).you can read here)
Installing it on your pc won't be enough .You need to apply the plugin in android studio as well.
Go to File>settings >(search for plugins in your left side)>select the option plugin > browse repositories > and install geni plugin and you are good to go!
Restart android studio.
Finally if i missed anything watch this video for full thing
Edit:If your are using a V.Box
Go to Network and Sharing Center > Change adapter settings and enable these:
Local Area Connection (if it's disabled)
VirtualBox Host-Only Network
I think that enabling the second will do the job, but I did the first anyways.
read More details --------> Unable to start Genymotion Virtual Device - Virtualbox Host Only Ethernet Adapter Failed to start
Hope it helps.
Try uninstalling your current version of virtualbox and install Virtualbox version 5.0.28 from here: https://www.virtualbox.org/wiki/Download_Old_Builds_5_0
The way around the error is to:
1) Click on the Genymotion Device Manager in Android Studio. Once the Genymotion Device Manager window pops up, you will see your virtual device/devices, and its/their status should be "off".
Genymotion Device Manager
Virtual Device Status is off
2) Now, go run Genymotion outside of Android Studio.
3) In Genymotion, click on your virtual device to select it and click on the start button at the top left corner to start the virtual device.
4) Once your virtual device is up and running, go back to the Genymotion Device Manager window in Android Studio and click on refresh. You should see that the status of the virtual device is switched to "on". Now, you can run your code directly to Genymotion.

Resources