January 20, 2021, 01:28:30 PM

Author Topic: Blitzmax NG - Building for Android  (Read 2728 times)

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 480
Blitzmax NG - Building for Android
« on: September 29, 2017, 01:29:26 AM »
This is a copy of Dabz's tutorial on bmx-ng.com which has now expired. I've backed up Dabz's Bmx NG Win32 0.77 in case you have any trouble with the official NG 0.87, but I removed the local MinGW32 folder.

Building for Android

Here, we’ll look at a quick guide to building Android apps from Blitzmax NG (Windows specific, but should be fine on other platforms).

1. Make sure you have the latest Windows Blitzmax NG package from the official Releases page.

2. You will need a few third party tools to get up and running. First up, Android relies on Java, so download and install the Java JDK SE 7 (*get the last version for your architecture).

Once installed, you need to create a new environmental variable on your system, the variable name is JAVA_HOME and the value should be set to point to the path of the Java JDK eg. JAVA_HOME = C:\Program Files\Java\jdk1.7.0_79.

Note: Remember, we need to add a new environmental variable, not edit any, so don’t go editing any in the list or deleting stuff!

Secondly, download and install the newest Android SDK (*using the SDK Manager from the Android Studio bundle) and Android NDK (*install with the SDK Manager?), make a note where you installed them on your system (You can use either the 32-bit or 64-bit version, obviously depending on your computers architecture).

Finally, download and extract Apache-Ant (*if using Java 7 the latest compatible version is 1.9.9) again, make a note of where you extracted the folder too as we need that path shortly.

3. Create a new file in your {$BLITZMAX-NG_ROOT_DIR}/bin folder called custom.bmk, and add:

Code: [Select]
addoption android.home "{$ANDROID_SDK_ROOT}"
addoption android.sdk "{$ANDROID_SDK_ROOT}"
addoption android.ndk "{$ANDROID_NDK_ROOT}"
addoption android.toolchain.version "4.9"
addoption android.platform "12"
addoption ant.home "{$APACHE_ANT_ROOT}"

Where {$ANDROID_SDK_ROOT} is the path to your new Android SDK installation which we made a note of earlier. Same with {$ANDROID_NDK_ROOT}. eg. C:\AndroidSDK. Just like above, {$APACHE_ANT_ROOT} is the path to the the root Apache-Ant folder we extracted earlier eg. C:/apache-ant-1.9.6.

4. Go into your {$ANDROID_SDK_ROOT} folder, and startup the SDK Manager.

Scroll down a little to you see “Android 4.4.2 (API 19)" (*it's best to install only for the platform you are testing, later you may want to install other API's). Click the check box next to it, then to the bottom right of the window, click “Install x packages”, you may need to agree to a few EULA’s before the installation process starts. Once everything is installed, close the SDK Manager.

5. Download and extract Brucey's Firepaint port (originally by Simon Harrison) here.

Open MaxIDE located in the  {$BLITZMAX-NG_ROOT_DIR} folder, then select File->Open menu item, navigate to the extracted firepaint folder, and open the firepaint.bmx file, which should then appear in MaxIDE.

In the MaxIDE menu, click Program->Platform->Android menu item, then, if you go to Program->Architecture, you will see a variety of platforms available, leave it at “ARMeabi v5” for now, but remember, the others are valid Android platforms, so if anything goes wrong, try selecting different architectures.

Click the Program->Build menu item, and hopefully everything should work and it will start building the application. The first build may take a while due to building modules, or take two build attempts, don't worry though this is usually a one-time thing and for following builds its much quicker.

If all is well, you will find your new apk is ready to upload to your device in the firepaintAndroid/android-project-firepaint/bin folder.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal