This article contains information to help you set up the Android export in GameMaker. Each section covers a different potential issue and how to resolve it, but if you have an issue that cannot be resolved through this article, please contact support.
Before doing anything else, it is highly recommended that you switch off your device and your PC and then restart them both. You'd be surprised how many problems can be resolved by a simple re-boot of your system!
Ensure You Are Using a Suitable USB Cable
Check that the USB cable you are using to connect your device to the PC is appropriate as there are many that will show connected on the ADB, but which will not permit the transfer of data (i.e.: they are charging-only), so if you test a GameMaker game on your device and the compile finishes and exits with no further debug message in the compiler window, this is definitely a sign that your cable may be at fault.
Enable Developer Mode and USB Debugging on the Device
Before you can get your device to connect and run games with GameMaker, you must first have enabled Developer Mode, and then enabled USB Debugging.
The Developer Mode screen is hidden by default, so to make it visible, go to your phone's Settings app, then locate and tap the Build Number value seven (7) times.
- Samsung Galaxy phones this is in About phone > Software Information
- OnePlus phones this is in About device > Version
- Google Pixel phones this is at the very bottom of About phone
Once you get to tap 3 or 4, you will see a prompt appear which counts down how many more taps are required. After the correct number of taps have been made the phone will say you are now a developer - it may tell you exactly where to find the new screen on your phone, but it will either be in the root of Settings or it may be off in Additional Settings.
Once you find the location of the Developer Options screen you can enable "USB Debugging" there. At this point you can connect your phone and it should prompt you after a second or two to trust the PC - say yes to this!
Connecting a Device (PC)
If you are having problems getting your device to be detected by your development computer or GameMaker, you need to make sure that it is discoverable using ADB. Below explains how to go about this:
- Connect your Android device to your PC via the data cable (USB)
- The device drivers should be installed automatically at this stage (if they aren't already), but if they are not, then please refer to your device manufacturer's support information to locate and install the correct ADB drivers. It is very important you get ADB drivers, not the standard consumer ones.
- Now test your phone driver to confirm if it's correct. This can be done in a couple of ways:
- If you have already set up a PATH variable to point to ADB directly (see here), then simply Windows Key and R to open a new Run window and type "cmd" (no quotes) and hit enter, then type "adb devices"
- Go to your Android install folder and then the "platform-tools" folder inside it (e.g. C:\android-sdk\platform-tools) and then hold down the shift key and then right-click in some empty space and choose "Open a command window here". In the new command window, type "adb devices" (without the quotes).
Once this has been done, GameMaker should be able to auto-detect the device in the Device Manager.
If you find that Windows itself does not recognise your device, you may need to manually install the device's required drivers.
If you have a Google device, for example, you would need to manually install the Google USB Driver by following a guide such as the following link:
Connecting a Device (Mac)
When you first connect your Android device to your Mac via USB, you will get a message on both the device and the Mac about "file transfer protocols" and at this point GameMaker will not be able to communicate with the device. To resolve this issue, download and install the Android File transfer app, which you can get from the following link:
Once you have installed the app on your Mac, follow these steps:
- Open Android File Transfer.
- Unlock your Android device.
- With a USB cable, connect your device to your computer.
- On your device, tap the "USB for..." notification.
- Select Transfer files.
- An Android File Transfer window will open on your Mac.
GameMaker should now be able to detect your device, and every time you connect it to the Mac from now on the Android File Transfer app will open automatically.
Set USB Storage
It has been reported that on some devices for them to work correctly you should set the USB Connection to permit the copying of files between the computer and the SD card by clicking on the button marked "Connect USB Storage". This may not be necessary but is worth testing should you be having problems.
Using Dropbox to Transfer Your Game
Another way to get your game onto your Android device without using the data cable is to use DropBox. Download their app from the Android Market and install it on your device, then save the game apk created by GameMaker:Studio to your DropBox account. Once that's done and your device is synced to the DropBox account, just run the apk from your device.
Using Logcat To Debug Your Game
If you want to monitor in-depth how your game runs on your target device, or if you want to pinpoint a crash or get more information about an error, then it's often useful to enable ADB debug output in the ADB log. To do that, follow these steps:
NOTE: From here on the guide will use <drive> when talking about the root folder for the Android SDK installation, so remember to substitute your actual drive letter in the paths when copying.
- If it's not already enabled, turn on USB Debugging on your phone in its settings panel.
- Plug the phone in to your PC. If required, your phone will install its drivers. Allow any driver-related prompts during this process.
- Assuming the drivers installed okay, check Device Manager in your Windows control panel to see if any remaining issues are present.
- If you have any yellow warning symbols next to "Android device", "Android Phone", etc., or something that references the model name of your device it's likely you're missing the ADB driver from the consumer driver package on the phone.
- You can get the generic Google ADB driver from <drive>:\android-sdk\extras\google\usb_driver. To use this, right-click the device with the warning icon and say you want to update the driver, that you want to provide the driver manually/it's already on your machine, and then point it to the folder just mentioned and click okay. Windows should now update the driver.
- Check that the warning icon is gone from Device Manager. If not, you may need to get specific ADB drivers for your device. Try Googling "[phone model name] ADB driver" and it should point you in the right place. Try to obtain a copy of the drivers from the official manufacturer download page or at least a respectable developer community.
- You can get the generic Google ADB driver from <drive>:\android-sdk\extras\google\usb_driver. To use this, right-click the device with the warning icon and say you want to update the driver, that you want to provide the driver manually/it's already on your machine, and then point it to the folder just mentioned and click okay. Windows should now update the driver.
- Now in control panel again, open System. Choose Advanced System Settings and switch to the Advanced tab. Click the Environment Variables button here. In the second box here ("System Variables"), scroll down a little to find the PATH variable. Select it, then click the Edit button. Press the End key on your keyboard to jump to the end of the text-box if you're not already there. Is there a ; at the end of the text already? No? Add one. Now add in <drive>:\android-sdk\platform-tools\ and then okay everything until you get back to Control Panel.
- Hold down your Windows key and then press R. This should open the Run dialogue. Type in "cmd" (no quotes) and press enter. A command prompt will open. Type in "adb devices" (remember the space, no quotes) and press enter. You should get some response from the adb server, probably to say the server isn't running and that it's starting it up, then an odd-looking code and possibly the name of your phone. As long as it has the code, the "name" is fine even if it seems odd.
- If it found a device you're all set up. Type "adb logcat" and you'll see a sudden rush of text. When this has caught up with itself you'll be looking at what the phone is doing right now. Do something on the phone and watch the log respond.
- If you got an error about Windows not being able to find ADB, then there was a mistake made in step 5. Check that you put the semicolon in before the new path to platform-tools and that you included the \ at the end. Try running "adb devices" again after checking the PATHS variable is correct.
- If ADB is okay, but it didn't find a device, check that you turned on USB debugging, etc., on the phone and your driver is okay in control panel. You may have additional security options which you will need to set on the phone, depending on the model of your device. If all else fails, try a reboot of your PC and phone. If a reboot fails to fix it, then possibly the Google ADB driver won't work for your phone and you will need to get the manufacturer specific one. Check step 6 again. In the event that you got any anti-virus/firewall prompts about talking to your phone at any point during this process, you will need to allow that communication.
- If you got an error about Windows not being able to find ADB, then there was a mistake made in step 5. Check that you put the semicolon in before the new path to platform-tools and that you included the \ at the end. Try running "adb devices" again after checking the PATHS variable is correct.
- Now that it's all working, any time you want to log something: plug your phone in, Windows+R, "cmd", "adb logcat", and watch the screen.
Nothing Works!
If you have tried all of the above, you should go back to the start of this document and make sure that you have done everything as stated and that your device meets the minimum requirements necessary.
Revise and make sure that the IP address, the ports and all other information is correct within GameMaker and that your installation of the Android SDK is correct too.
Take a moment to read the other troubleshooting tips also, as it may be something a simple as out-of-date drivers that are the problem.
If all else fails you can speak to other users about the issues on the GameMaker Community Forums, or open a ticket with the helpdesk.