This document explains how to build the FlappyBird Android game on macOS, Linux, and Windows using either the provided shell script or Makefile.
Before building, you need to set up your environment variables:
-
Copy the
.env.examplefile from the project root to.envin the project root:cp .env.example .env -
Edit the
.envfile in the project root to match your local setup:Make sure to:
- Update the paths to your Android SDK and NDK installations
- Change the
PACKAGE_NAMEvariable to match your desired package name for the app - Update the
BUILD_TOOLS_VERSIONvariable to match the version of the Android build tools you have installed - Set a secure
KEYSTORE_PASSWORD
The build system uses the Android command-line tools. You'll need to specify the path to your Android SDK and NDK in the .env file.
To build using the shell script:
cd FlappyBird
./build.sh
The signed APK will be generated at:
app/build/outputs/apk/FlappyBird-signed.apk
Note: The script will automatically install and run the app on a connected device.
To build using the Makefile:
cd FlappyBird
make
To clean the build:
make clean
To install and run on a connected device:
make install
# or to also start the app:
make run
To debug the app:
make debug
- Native Code Compilation: The NDK builds the C code into shared libraries for armeabi-v7a and arm64-v8a architectures
- APK Creation: An empty APK is created with the manifest, resources, and assets
- Library Inclusion: Native libraries are added to the APK in the correct location (
lib/<abi>/) - Alignment: The APK is aligned for better performance
- Signing: The APK is signed with the provided keystore
- Cleanup: Temporary files are removed
If you encounter issues:
- Ensure all paths in the
.envfile are correct for your system - Verify that the Android tools are properly installed
- Check that you have the required Android platform (android-30) and build tools (30.0.3)
- Make sure your device is connected and recognized by adb (
adb devices) - Ensure the keystore file
mykeystore.jksexists in the FlappyBird directory or create one with:keytool -genkeypair -dname "cn=Mark Jones, ou=JavaSoft, o=Sun, c=US" -alias business -keypass your_password -keystore mykeystore.jks -storepass your_password -validity 20000