If you have just completed the tutorial Building your first Android game or if you have just forgotten how to get your latest project from your PC and onto a device – here is how to do it. This tutorial will show you how to run the game on your device while connected via a USB cable. Once you have done this the game will remain on your device to play, with or without being connected to your development machine.
The first thing to do is to visit your device manufacturer’s website and obtain and install any drivers that are required for your device and operating system. The next few steps will setup the Android device for debugging. Note that different manufacturers structure the menu options slightly differently to others. But the following sequence is probably very close, if not exact for enabling debugging on most devices.
- Tap the Settings menu option or the Settings app on your phone/tablet.
- Tap Developer options.
- Tap the checkbox for USB Debugging.
- Connect your Android device to the USB port of your development system.
- Click the Play icon from the Android Studio toolbar as shown.
When prompted click OK to debug the game on your chosen device.
The game will now run on the device as shown.
As we progress through the tutorial-related mini-projects we will see how the device outputs information to Android Studio so we can monitor and debug our games. This is the next Android tutorial designed to be read in conjunction with these Java tutorials.
I’ve set up the Android Studio on my Mac, but the computer can’t find my mobile phone (samsung galaxy s3 neo) when I connect it via USB. I can exchange Data with the mobile phone, but the Android studio can’t find it. what can I do to fix this?
Hi Johannes,
A couple of things to check.
Have you enabled USB debugging on the phone itself? Also, some older phones (like my S2 maybe your S3) require a specific device driver from Samsung.
I connect my device tab 4 Samsung and it doesn’t recongnize it
What should I do?
Have you/do you need to, for your device install drivers for Windows? And have you enabled USB debugging in the device settings page? Hope this helps.
Yes , I have did this two. it doesn’t work . Btw , I have win10
What should I do know ?
I have changed the cable . It seems that the cable I was using cold only transfer power , not data.
Thanks anyway for the tutorials
Thanks for letting us know the solution. I couldn’t have guessed at that. This might help someone else.
Whenever i try to launch on my one plus x (android 5.1.1) it says “instant run requires that the platform xorresponding to yoir target device(Android 5.1 (Lollipop)) is installed” how do I Fix this, and there is always a sign that says Gradle project sync completed with some errors
This could be a glitch.
As asked using the e-mail, would you be generous enough to provide tutorial on the codes to state how and where the output will appear i.e. in the logcat vs the android device. Thank you.
The output appears on the devive.
Hello John, I think you misunderstood me. I am actually not referring to this specific tutorial of the hello world. The next ones all have the output in the logcat in android. I am asking for the code difference how to put the output in the device instead of the logcat.
Hi Julian,
Here is a really good tutorial for outputting text to a TextView.
http://android4beginners.com/2013/06/lesson-1-3-how-to-modify-textview-in-java-code-findviewbyid-settext-and-gettext-methods/
Hi John, Google doesn’t seem to be able to explain this. What is padding in android? Spacing outside the object or for words?
This is a good starter for layouts including padding. https://developer.android.com/guide/topics/ui/declaring-layout.html
An index of all the courses in order would be REALLY useful. Can’t see what the next one is!
Thanks for pointing this out. I have added a couple of links to the end of this article and will have a think about a better way of indexing.
Please can I get a software to develop games on my phone.
or any similar app to Android Studio
Android Studio develops games on your phone. What features are you seeking that Android Studio doesn’t have and I will see if I know any.
Android Studio develops games on your phone. What features are you seeking that Android Studio doesn’t have and I will see if I know any.
Good information
i cant find DEVELOPER TOOLS on my phone.
1. Tap the Settings menu option or the Settings app on your phone/tablet
2. This next step will vary slightly for different versions of Android. The Developer options menu is hidden away so as not to trouble regular users. You must perform a slightly odd task to unlock the menu option. Tap the About device or About Phone option. Find the Build Number option and repeatedly tap it until you get a message informing you that You are now a developer!
3. Go back to the Settings menu
4. Tap Developer options
5. Tap the checkbox for USB Debugging
6. Connect your Android device to the USB port of your computer
7. Click the play icon from the Android Studio toolbar as shown in the next image
You have explained the topic very well. Thanks for sharing a nice article.