Search This Blog

Wednesday, May 17, 2017

Deploy ionic app on a real android device via USB on a virtual Machine

In case you are ready with your ionic app and you want to push your app to the virtual machine either vm ware or the virtual box, this article is for you keep reading.

 

This article will help in following situations:

  • You are not able to run the ionic app on your android device as a target and the live reload of your android app is not working.
  • If  your virtual machine is not able to load or list the devices and its not found on the system.

 

ionic on android real device error

I am assuming you are done with your ionic app creation and you have your real android phone and your virtual machine, vm ware in our case is ready.

Step 1

Connect the phone via USB to the USB 3 port, mine was on left side.

 

Step 2

Go to device settings and choose developer options.

Enable all USB related options for app and debugging.

image

 

Step 3

Go to the virtual machine and see the status of your device in device manager.

If its yellow mark and ADB as text, you are missing drivers.

Try to update the drivers by right click and search online.

In case windows is not able to find drivers for your android phone.

Download the PDA net application from the internet.

http://pdanet.co/a

Accept defaults and choose the others options for phone selection, mine was xiaomi so I had to choose others.Once installed, tray icon will have pda application running.

If your PDA application has red mark, it means your usb connection is not enabled for file transfer.

 

Re connect the phone and this time, whenever the popup comes on your android device, select MTP.

Now the status of PDA will change to connected.

image

And you will get a message saying successfully connected.

This is right time to fire up the command prompt and see if our device is visible in the adb list of devices.

 

> adb devices ( You should see your phone connected.)

adb devices android connected list

 

Great, our device is visible now and in case of an avd emulator, you will see emulator prefix the the device id.

 

Lets push the app to a real device and see how our ionic app runs on the android phone.

> ionic run android ( you need to be in your apps folder where the app is deployed, just above WWW folder)

 

ionic build android success real device on vm

 

so the ionic has triggered an ionic build and the apk is pushed to the device as shown above.

Also whenever an alert comes on your phone, choose always trust this computer and accept the app deploy notification. Else it will be auto rejected and you won’t be able to see your app.

Also its a good idea to have an icon for your app, else it will be deployed with the default icon.

So this is the end of this article, I hope you were able to test your ionic app on a real device and your real device is visible on the adb devices list, if not leave a comment and I will try to help.

Keep Reading !

No comments:

Post a Comment