Hi OFL community
This is the first time I try to test/compile for Android with openfl test android and I get an error I can’t get rid of: Badly formed android PLATFORM "21" - should be like android-123
My setup:
The error happens because lime sets PLATFORM to the wrong value due to a recent change.
However, it seems there might be a deeper problem here, because the only reason hxcpp reads PLATFORM is when it thinks you’re using an NDK version older than r20:
In your case you are trying to use r21, so that means that there might be something wrong with your setup. Please could you share your exact hxcpp version, as well as the output of lime config?
Anyway I download the latest release of hxcpp (4.3.106) from github and put it into the /lib/hxcpp folder next to 4.3.2 (which is odd because it’s newer than the one I downloaded) I edited the .current file to point to the 4.3.1206 and… I get the same error
Yes thank you @tobil4sk you are absolutely right ! For some reason the file path was wrong.
Now it compiles … almost. I get an error from Gradle:
FAILURE: Build failed with an exception.
* What went wrong:
BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 69
> Unsupported class file major version 69
@785597448 I really would like to!
In the old days (like 2010 you see ), I would code in IntelliJIdea in AS3, plugged in my Pixel phone and my iPhone via USB, hit the “test on iPhone” or “test on Android” button and voilà! But I think those days are gone forever, and I can’t find any method to compile and test in AIR directly on devices when coding in OpenFL / Haxe. Or am I wrong ?
Yes that’s what I do every day for testing in ADL, but what if I want to test on my phone ?
I had a look at the Harman doc but there is no example in the Android section about packaging an APK (only AAB), or testing on a real device.
Maybe I’ll have a look to ADT tool docs but I don’t feel too confident about that, and I taught compiling to native Android app would be more efficient.
You can build for AIR with OpenFL, including getting an APK for Android and an IPA for iOS.
lime build air -android
lime build air -ios
It looks like lime test air -android and lime test air -ios should work too. They should install the app on your device and launch it, if possible. However, even if lime test doesn’t work, you can still get the APK/IPA produced by lime build and install it manually.
Thanks a lot Josh. I was able to compile to AIR for Android and install in one command with lime test air -android. It’s that simple!
I see that Haxe + Lime + OpenFL + FeathersUI are very powerful tools.
I don’t want to be rude of course, and I know that setting all this up took a huge amount of time, but I think the documentation related to compilation on different platforms could be improved, especially for beginners. If I manage to navigate through my small project, I’d be happy to contribute if needed.
I just committed a change to Lime tools that will check that the values of the config values needed for Android actually point to existing directories and report an error if they don’t. This should help make an issue of an invalid path like this much more obvious right away.
This error sometimes means that your Java VM is trying to run a JAR file compiled for a newer version of Java.
However, I’ve noticed that it can also happen if the various versions of Gradle tooling used for building for Android don’t match up properly with your project’s Android target-sdk-version, even if you have a new enough version of Java installed on your system.
You can customize the target-sdk-version, gradle-version, and gradle-plugin values in your project.xml. Here’s what it might look like if you simply used the default values for each of these in Lime 8.3.0:
If you happen to have changed the target-sdk-version, it’s likely that you’ll need to update the other two as well. This page has various charts that can help you choose which versions are needed for Gradle version and AGP (Gradle Plugin) version:
That’s good to know… For now, I will stick to compiling in Air for Android because I’m not yet familiar enough with the specifics of a native compilation. I also need to study the options in the project.xml file in more detail.