Yesterday and today, I tried building an OpenFL app for Android, and I ran into some issues.
I assumed that I could simply install Android Studio, and it would provide the correct SDKs, but I guess that’s not the case. I ran lime setup android
and specified the paths to the SDKs that Android Studio downloaded. When I tried lime build android
, I was getting this error:
arm-linux-androideabi-g++ is not recognized as an internal or external command
(I’m on Windows 10, by the way)
I found a couple of topics here in the forums mentioning that error, but no clear solution.
I found the Lime: Setup Android page that suggested specific versions of certain packages, so I figured that something must be wrong with using the latest SDK/tool versions. However, I determined that Android Studio lacks the capability to choose specific versions of certain tools, and my best guess is that this is probably why the Android build was failing for me when I used Android Studio to install the SDKs.
In the end, I ended up manually downloading the SDK and NDK and installed everything from the command line using sdkmanager.bat
. However, even then, there were some issues.
Here was my first attempt to install what was needed, based on the versions mentioned in the Lime docs:
sdkmanager.bat "platform-tools" "platforms;android-19" "build-tools;24.0.1"
I also manually downloaded NDK version r13b, as suggested in the docs.
My first build attempt with the new SDKs ended up with some error mentioning “Android 26”. So, I tried installing that platform version instead of 19:
sdkmanager.bat "platforms;android-26"
This seemed to work better because the build made it further in the process, but then I got this error:
:deps:extension-api:processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':deps:extension-api:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'c:\Users\josht\Development\Android\sdk\build-tools\24.0.1\aapt.exe'' finished with non-zero exit value -1073741819
I next tried to install a newer version of build-tools:
sdkmanager.bat "build-tools;28.0.3"
One more build, and I finally found success! I tried lime test android
next, and the app opened on my device connected over USB.
If it’s possible to get this working with Android Studio, I think that the process needs to be be documented because Google’s page strongly encourages you to download Android Studio to get the SDK. I don’t think that everyone is going to figure out that they need the standalone SDK when things fail with Android Studio, or how exactly to find it.
The versions of the various tools that are required to build for Android should probably also be updated on the Setup Android page too, assuming that they are indeed out of date, as they seemed to be here.
I do not necessarily feel confident that I have everything set up correctly or in the simplest way possible, and I’m wary of the idea that something might break unexpectedly in the future if I ever update Lime.