Frametagmedia

How to Export Test Apps from OpenFL on non-iOS platforms

Posted on August 30, 2020 by Developers tagged with , , , , , , , under How To

Testing apps with OpenFL is a generally a straightforward process, but to streamline this, you can follow our step-by-step guide here to test on all platforms except iOS (for which we’ve made a separate guide, here).

Development environment:

Haxe 4.1.2
Lime 7.8.0
OpenFL 8.9.7-Lpv3od
  1. Install Haxe via:

https://haxe.org/download/

Then, run the below in Terminal using the default settings:

     haxelib setup

Then install OpenFL and Lime via Terminal (default settings in setup are fine) with:

     haxelib install lime
     haxelib run lime setup
     haxelib install openfl
     haxelib run openfl setup
  1. Test OpenFL is working with:
     openfl
  1. Create a sample project/navigate to a project directory in command line:
     openfl create DisplayingABitmap
     cd DisplayingABitmap
  1. Ensure the project works normally:
     openfl test neko

Windows

Development environment:

     Windows 10 Home 2004
     Visual Studio Community 2019 16.6.4
  1. Setup Windows export/testing with the following command:
     lime setup windows
  1. After installing a C++ compiler (ideally Microsoft Visual Studio as linked in the setup) you can finish by running the following command:
     lime test windows

Android

Development environment:

     Windows 10 Home 2004
     Samsung Galaxy S10+ on Android 10
     Android 10.0 (Q) Rev. 4 SDK
     Android 21.3.6528147 NDK
     Java 14.0.1 JDK
     Android SDK Platform-Tools 30.0.3
  1. Setup Android export/testing with the following command:
     lime setup android

And provide your Android SDK location, Android NDK location, and Java JDK location (default install locations below, replace {USER_PROFILE} with user folder name):

     C:\Users\{USER_PROFILE}\AppData\Local\Android\Sdk
     C:\Users\{USER_PROFILE}\AppData\Local\Android\Sdk\ndk\21.3.6528147
     C:\Users\{USER_PROFILE}\Java\jdk-14.0.1
  1. Ensure an Android device is plugged in via USB with USB debugging enabled in Developer options, then run the following command:
     lime test android
  1. If the build fails with “Could not initialize class org.codehaus.groovy.reflection.ReflectionCache”, one solution may be to change/append the gradle version to the project.xml file with this line, then run the test command again:
     <config:android gradle-version="6.3" />

macOS

Environment:

     mac OS Catalina 10.15.5
  1. Run the following command:
     lime test macos

Linux

Environment:

     Ubuntu 18.04.4 LTS
  1. Setup Linux export/testing with the following command:
     lime setup linux
  1. Run the following command:
     lime test linux

And there you have it. You are now able to test your OpenFL apps on all non-iOS platforms.