I recently ran into a frustrating issue while compiling an Android APK in GameMaker Studio Pro v1.4.1567. After setting everything up and hitting the build button, I got this error:
Error Code
BUILD FAILED
C:\Program Files\Android_SDK\tools\ant\build.xml:649: The following error occurred while executing this line:
C:\Program Files\Android_SDK\tools\ant\build.xml:694: null returned: 1
At first glance, it looked like a cryptic build issue. But after some digging, I figured out what was wrong and how to fix it. In this post, I’ll walk you through everything from identifying the cause to enhancing your test project with Android features.
Basic GameMaker Android Build Code
Before troubleshooting, I like to make sure the project itself is working. Here’s a super simple GML code snippet that runs on Android:
// Create Event
show_message("Hello Android!");
This helps verify whether GameMaker can successfully compile and launch your game on Android. If this doesn’t build, chances are something is off in your SDK/NDK or Java setup.
The Compile Error
If your build fails with this message:
BUILD FAILED
C:\Program Files\Android_SDK\tools\ant\build.xml:649:
C:\Program Files\Android_SDK\tools\ant\build.xml:694: null returned: 1
It means ANT (the build system used by GameMaker Studio 1.x) ran into a problem usually related to paths, tools, or missing dependencies.
Explanation of the Error
The error comes from Apache ANT, which uses XML scripts (build.xml
) to handle compiling the Java/Android parts of your GameMaker project.
Specifically:
- Line 694 fails when ANT expects a valid return value or path, but gets
null
. - It returns
exit code 1
, which is a generic “something broke” signal.
This usually points to something being misconfigured, outdated, or missing in your Android toolchain.
Like Causes & Fix
Here’s a quick table of what might be going wrong and how I fixed it:
Cause | Fix |
---|---|
Incompatible SDK version | I was using API 13, but upgrading to API 14 or 16 made the build work without errors. Even though GameMaker says API 10+, modern tools sometimes reject older APIs. |
NDK mismatch | I’m using NDK r10e, which is the right version for GameMaker 1.4. Make sure it’s installed properly and the path is set: C:\Android\ndk\android-ndk-r10e . |
Incorrect Java version | GameMaker 1.4 doesn’t like newer Java versions. I had to uninstall Java 11 and reinstall Java JDK 1.7.0_80. That fixed a lot of ANT issues. |
Missing Build Tools | GameMaker prefers Build Tools 22.0.1. If you’re using a newer SDK Manager, you’ll need to find and manually install that version from Google’s archives. |
My GameMaker Android Configuration Checklist
Here’s what finally worked for me. Double-check these:
- SDK Location:
C:\Program Files\Android_SDK
- NDK Location:
C:\Android\ndk\android-ndk-r10e
- JDK Location:
C:\Program Files\Java\jdk1.7.0_80
- Build Tools Version:
22.0.1
installed inside:C:\Program Files\Android_SDK\build-tools\22.0.1
- Target SDK in GameMaker Project Settings:
Set to match the installed Android API level (I used 14 or 16).
More Practice Functionality to Add in Your Game Code
Once your basic build is working, you might want to test some actual Android-specific features. Here’s what I added to my test project:
Vibrate the Device
// Create Event
if (os_type == os_android) {
show_message("Running on Android");
android_vibrate(500); // Vibrate for 500 ms
}
Play Background Music
// Create Event
audio_play_sound(snd_music, 1, true); // Loop the background music
Note: Make sure snd_music
is added to your project’s sound assets.
Animate a Sprite
// Step Event
image_speed = 0.2; // Slows down the sprite animation
Attach a multi frame sprite to your object to make it animate smoothly on-screen.
Final Thought
If you’re still sticking with GameMaker Studio 1.4, you’re not alone I get the appeal of its simplicity. But working with older SDKs and tools means you’ll occasionally run into strange build issues like this.
Just remember most of the time, it’s about toolchain compatibility especially Java, NDK, and build tools. Take the time to align those, and your Android builds will compile like butter.