• Sponsored Links

Step 6 : Step by Step libGDX Tutorial : Executing demo project for Android

Share this :

Executing demo project for Android

Well the last section was about executing the project in Windows but this section is far more exciting then last one as in this section we will focus on how to execute the demo project in your own Android phone or in a AVD . AVD stands for Android Virtual Device which means if you dont want to test the application on your real android device for any reason you can test on this virtual device . Follow the steps ahead

  • For my case I need to run versionpb-android .Right click versionpb-android in Eclipse , Select Run As and select Android Application

Android_JavaApplication

  • Doing that Android device chooser will open up as screen below

AndroidDeviceChooser

The Upper Section is for a running android device i.e. a real android device connected to your laptop/machine with USB and with USB debugging enabled . Lets enable developer options in the mobile phone .

I am using Samsung Galaxy S3 whose developer options are found in Settings -- > More . by default developer options are hidden . To know how to un hide it , read this blog .

Once developer options are visible , turn USB debugging on and connect device with your laptop/machine . You will see a message on my mobile stating Allow USB debugging ?

Click OK and you will see your device as in Online State in Android device Chooser . See screenshot below :

MobileDeviceOnline

Select this device in Android device chooser and click OK . Doing that Demo app will open up in your mobile device .

You may get an error stating unfortunately the android has stopped i.e. your android app may crash  as It  happened with me as well .

To fix this  :

  1. right click your android project
  2. Select properties
  3. Select Java Build path
  4. it will be something like below :
  5. AndroidCrashFix
  6. Check all the unchecked values and click OK .
  7. Remove your device from your laptop USB .
  8. Clean and build your project by Clicking Clean as below :

CleanProject

  • Add your device back to USB with machine . Allow USB Debugging and run the android project again .
  • This time you will see demo app running on your mobile .


To run this on a virtual device you need to create a virtual device .Read following to know How to create a virtual device .

Once your Android Virtual Device i.e. AVD is seen in the list of AVDs  , Select the AVD and click OK and you will see demo project running on your AVD as per screenshot below :

AVDdemo

Leave a Reply

Your email address will not be published. Required fields are marked *

62 − = 53