An example game that uses FXGL and runs on a mobile device.
Note: you need to have a real Android 5.0+ device.
If you have android tools installed, go to step 3.
-
Download Android SDK Tools. Scroll all the way down and at the bottom click on your platform SDK Tools.
-
Extract everything and install the tools:
ANDROID_SDK/tools/bin/sdkmanager "platform-tools" "build-tools;27.0.3" "platforms;android-25" "extras;android;m2repository" "extras;google;m2repository"
- Open
build.gradle
and edit the following line so that it has the path to where yourandroid-sdk
is extracted:
androidSdk = 'PATH_TO_ANDROID_SDK'
OR
Define a global gradle property named ANDROID_HOME
inside ~/.gradle/gradle.properties
that points to the location of the Android SDK:
ANDROID_HOME=/path/to/android-sdk-directory
- Build .apk (will be built to "build/javafxports/android/"):
./gradlew android
OR build and install to a connected device:
./gradlew androidInstall
Note: you need to have a Mac with MacOS X 10.11.5 or superior and Xcode 8.x or superior.
-
Open Xcode with a new project, e.g. Single View Application
-
Go to Preferences -> Accounts and add your Apple ID
-
Connect your device to your Mac and enable your device as a developer device
-
In Xcode change the bundle name of the app to be
com.almasb.fxgltest.SampleGameApp
. At this point Xcode should automatically create certificates and an iOS Development provisioning profile. -
In Xcode select your device from the devices to run applications on and click run.
-
The following should build and install the game to a connected device: (Note: the very first build will take ~20-30 mins)
./gradlew launchIOSDevice
If you have problems running on iOS, please read JavaFXPorts Docs.