IN THIS ARTICLE
Set up your environment to develop for Android with Lumberyard
Set up your environment to develop for Android with Lumberyard
This section walks you through the steps needed to get your development environment and Amazon Lumberyard projects ready for build and deployment to Android. To get started, make sure that you have the Prerequisites. To learn about the platform-specific steps involved in project configuration and building, see Configure Lumberyard projects for Android and Build and deploy your project for Android.
Topics
Lumberyard environment setup
After you’ve installed the prerequisites, configure your Lumberyard installation to allow Android builds.
To allow Android builds
Start the Lumberyard Setup Assistant. If you’re installing Lumberyard for the first time, Setup Assistant starts automatically. Otherwise, launch it from
lumberyard_install_dir\dev\Tools\LmbrSetup\Win\SetupAssistant.exe
.
Using Setup Assistant, select the following capabilities for your Lumberyard configuration:
- Run your game project
- Run the Lumberyard Editor and tools
- Compile the game code
- Compile the Lumberyard Editor and tools
- Compile for Android Devices
After selecting these capabilities, select Next to continue with configuration in the Setup Assistant.
Provide the paths to the Android Studio installation, and the
ndk-build.cmd
andadb.exe
Android tools commands. These paths are used to determine the location of all of the Android build tools that Lumberyard uses. If you performed a default install of Android Studio and its tools, Setup Assistant should have already detected the installation paths.If you used another install location, or Setup Assistant couldn’t find your Android install, provide the paths to the appropriate tools. You can also select the Browse button to use Windows Explorer to navigate to the required files.
By default, the tools are located at the following paths.
- Android Studio installation —
C:\Program Files\Android\Android Studio
ndk-build.cmd
—C:\Users\username\AppData\Local\Android\Sdk\ndk\version\ndk-build.cmd
adb.exe
—C:\Users\username\AppData\Local\Android\Sdk\platform-tools\adb.exe
Tip
If you can’t find your Android SDK install inC:\Users\username\AppData\Local\Android\Sdk
, the SDK location might have been changed in Android Studio. To find out the location for your Android SDKs, follow these steps in Android Studio 4.0.x:
Open the Settings pane in Android Studio, either by navigating to the File > Settings menu from an open project, or by selecting Settings from the startup window. In the left navigation pane of the Settings window, select Appearance & Behavior > System Settings > Android SDK. Note the path displayed as the Android SDK Location. Use this as the base path for locating the Android tools.
When each Android tool is marked with a green checkmark icon, you can close the Setup Assistant.
Check that the API level for the Android SDK you’re using is correctly set in the Lumberyard build settings.
Open the file
lumberyard_install_dir\dev\_WAF_\android\android_settings.json
in a text editor.Change the value of
SDK_VERSION
toandroid-apilevel
, andNDK_VERSION
toandroid-ndk-version
. Use the API level of your development SDK for apilevel, and the API version of the NDK for ndk-version.For example, for Android Q (API level 29) and NDK API version 21, your configuration file will be similar to the following.
```
{
"DEV_KEYSTORE_ALIAS" : "development_keystore",
"DEV_KEYSTORE" : "_WAF_/android/dev.keystore",
"DISTRO_KEYSTORE_ALIAS" : "distribution_keystore",
"DISTRO_KEYSTORE" : "_WAF_/android/distro.keystore",
"BUILD_TOOLS_VER" : "latest",
"SDK_VERSION" : "android-29",
"NDK_PLATFORM" : "android-21",
"BUILD_ENVIRONMENT" : "Development"
}
```
Configure the Lumberyard build system.
Open a Windows command prompt and navigate to
lumberyard_install_dir\dev
.Run lmbr_waf configure.
At this point, if you’re missing any of the required packages or tools, or if Lumberyard needs additional configuration,
lmbr_waf configure
will report an error telling you what you need to install or edit to get your build working. Use either Android Studio SDK Manager or https://developer.android.com/studio/command-line/sdkmanager to install any missing packages or SDKs.
Important
At this point, don’t rebuild your game or engine. Wait until after you configure your project for Android, so that the Lumberyard tools will pick up those changes.
Add Android tools to PATH
When working with Android, it’s useful to have access to the SDK tools directly from the command line. If you’re working with build infrastructure or on a development team for your project, we recommend that you add the Android build tools to your PATH
environment variable. To set an environment variable on Windows, follow these steps.
Open the Windows Control Panel and select System > Advanced system settings.
In the System Properties dialog box, select Environment Variables.
Under User variables, edit the PATH variable to add the directories containing the Android tools. Select the New button to add a new value to
PATH
. The values that you add are the directories containing theadb.exe
andndk-build.cmd
files.
Build system setup
Now that you have Android support enabled in Lumberyard, you need to configure the build system to recognize your project and produce Android (es3
) assets.
Open the file
lumberyard_install_dir\dev\_WAF_\user_settings.options
in a text editor.In the
[Game Projects]
section of the configuration file, change the value ofenabled_game_projects
to include the project that you want to build for Android. This value setting is a comma-separated list of the projects to generate Android targets for during configuration. Either remove the existing values, or add your project name to the list. For example, to enableSamplesProject
,MultiplayerSample
, and your project:
[Game Projects]
enabled_game_projects = SamplesProject, MultiplayerSample, your-project-name
Save and close the file.
Open the file
lumberyard_install_dir\dev\AssetProcessorPlatformConfig.ini
in a text editor.Remove the semicolon to uncomment
es3=enabled
.[Platforms] ;pc=enabled es3=enabled ;ios=enabled ;osx_gl=enabled
Save and close the file.
Start the Asset Processor to compile any existing assets for use on Android.
Check to see if the Asset Processor is running. Open the Windows system tray and look for the Asset Processor icon.
If the Asset Processor is running, double-click the icon in the tray to bring up the Asset Processor window.
If the Asset Processor isn’t running, launch it from
lumberyard_install_dir\dev\Bin64vc142\AssetProcessor.exe
.
Wait until the Asset Processor finishes building all of your assets for use with Android. When assets are finished processing, the Asset Processor status line indicates that the Asset Processor is Idle.
Next steps
Now that you have your Lumberyard environment configured for Android, configure, build, and deploy your project to a device to test.