Sunday, January 27, 2013

Running HelloGalaxy App on my Phone

In my last blog post I showed how to run the HelloGalaxy App directly from eclipse onto the AndroVM.  In this post I will show how to run the app directly on my Galaxy S3 phone from Eclipse.

The long way around is to copy the .apk file onto your phone using Android the Android File Transfer app (See notes from my previous post about this app).  For example, of you copy the HelloGalaxy.apk to your Downloads folder on your device and then browse via "My Files" app on your phone and attempt to launch / install the app, you will get a bunch of warnings about installing apps from unknown sources.

The easy way is to enable debugging on your phone.

Select Settings, then choose developer options and select USB Debugging mode.



Then connect your phone with the USB cable and thereafter the steps are similar as described in my previous post about running the app on a virtual device directly from eclipse.

The ADB will automatically connect to your device and when you run your app from Eclipse, you will see your phone in the Android Device Chooser.

Here is the final result of the App running on my phone.


Happy Coding ;)

Run Android App from Eclipse on AndroVM Virtual Device

In this post I will show how to run my hello world app called HelloGalaxy from Eclipse on my virtual Android device. (I described how to build, package and deploy the app in previous posts).

Fire up AndroVM and note the IP Address of the device as described in my previous post, where I described how to deploy your app to AndroVM .

Connect to your running VM on the command line.


cd ~/develop/adt-bundle-mac/sdk/platform-tools$

$ ./adb connect 192.168.56.101

To check that you are connected, simply execute:


$ ./adb devices
List of devices attached
192.168.56.101:5555 device



Now you can execute your app from Eclipse.  When you select Run-> Run As -> Android Application (as I described in Building HelloGalaxy post).  This will compile, build and package the HelloGalaxy.apk file and pop up a Android Device chooser dialog.



Select the AndroVM device and click OK (You can also check the :Use same device for future launches" to skip the dialog on the next run.

Check the log files in the eclipse console and you should see messages saying: "Uploading HelloGalaxy.apk...", Installing HelloGalaxy.apk...", "Success!", "Starting Activity...", etc.


Thats it.  You may need to bring the AndroVM to the foreground and you should see HelloGalaxy running on the device.

If you make any code changes, simply select Run from the Run menu and your app will be re-compiled, packaged, deployed and executed on the AndroVM.