Feathers UI may be used to build mobile applications targeting Google's Android operating system.
In addition to the dependencies specified in the Feathers UI installation instructions, building an Android application with Feathers UI has some additional requirements.
Install the Java OpenJDK (version 8 or newer)
- Launch Android Studio at least once to go through its setup wizard that downloads the Android SDK components.
Download Android NDK r15c (do not download a newer NDK version)
- Extract the archive somewhere on your file system, and take note of the absolute path because it will be used in a later step.
Configure OpenFL for Android
To set the locations of various tools required to build Android apps, you need to run the following command:
openfl setup android
It will request the paths to several of the required tools that were installed in previous steps.
Pass in the absolute path of the Android SDK.
Run Android Studio at least one time to go through its setup wizard that downloads the Android SDK components.
Typically, when the Android SDK is installed by Android Studio, it is located at a standard location on each platform:
- Windows: C:\Users\username\AppData\Local\Android\Sdk
- macOS: ~/Library/Android/sdk
- Linux: ~/Android/Sdk
Pass in the absolute path where you extracted the Android NDK.
The Java JDK may be installed in a variety of locations, depending on which operating system you are using:
- Windows: Typically, Java is installed to C:\Program Files\AdoptOpenJDK or C:\Program Files\Java
- macOS: Run the /usr/libexec/java_home command in the Terminal app to find the JDK location.
- Linux: Run the whereis java command in a terminal to find the JDK location.
JAVA_HOMEshould be set to parent of the bin folder that contains the java executable.
To build for the
android target, run the following command.
openfl build android
-debug flag to create a build to include extra debugging information, including full stack traces when there's an exception or crash.
openfl build android -debug
The build's output will be written to the bin/android/bin folder. The .apk file may be found in bin/android/bin/app/build/outputs/apk/debug (including release builds).
Your project.xml file may optionally specify an output folder different from bin.
In the example above, the output would be generated in Export/android/bin instead.
Error: arm-linux-androideabi-g++: command not found
There is more than one possible reason for seeing this error:
You may have downloaded the wrong version of the Android NDK. You must use r15c specifically. Newer versions will not work.
You may have used the wrong path to the Android NDK on your file system. Check that the root folder of the SDK contains multiple sub-folders and files, including a README file.
Did you get some other error message that you don't understand?
Configuring OpenFL to build for native targets, like iOS or Android, can be a little tricky! Head over to either the Feathers UI community forum or the Feathers UI Discord. Explain which command you tried to run, be sure to mention that you are targeting android, and post the error message (and any additional relevant output). Ideally, we can help you figure out a solution, and then we'll also add it to this troubleshooting section, so that everyone can benefit.