Android testing- "more than one device"


I’m using latest Haxe, Lime, OpenFL and HaxeFlixel to experiment with a small game. I’ve finally gotten android compilation to work by:

  • Installing Android SDK 19 + platform-tools
  • Installing jdk8
  • Installing an old NDK without using Android SDK manager, version r13b

It’s a bit of a challenge to get things to work currently. Only got there by trial and error, installing specific older versions, and following different (sometimes outdated) advice. I think that currently at least the HaxeFlixel Android install instructions are outdated, but I’ll take that up with them.

OK, my question is: When I connect my test device and compile for Android:

openfl test android

I get this:


Total time: 13.978 secs
error: more than one device/emulator
error: more than one device/emulator
Performing Streamed Install
adb: connect error for write: more than one device/emulator

How can I direct haxe/openfl/lime to send the apk to a physical, USB-connected device, and ignore the emulator? I know I can specify “-emulator”, but what about the other way around?

I’ve succesfully tested on this device with Android Studio, and would prefer to keep one or more emulators installed.

In what way? I assume you mean this page?

I believe you can run the commands in a shell where you have already used ADB to connect to a device, or you can use openfl test android --device= or whatever the IP address is of the target device

So, I have installed Android Studio and via that the Android SDK 19, platform tools, and NDK. The NDK I have installed through Android Studio is 19.2.5345600, a recent one. When I run
lime setup android
and point it at the installed NDK 19, then try to compile for Android, I get:
'arm-linux-androideabi-g++' is not recognized as an internal or external command, operable program or batch file.
The solution, for me, was to download Android NDK r13b and point to that during “lime setup android”. In other words I have it installed alongside with the recent one (Android SDK Manager and Studio don’t allow you to easily roll back the NDK, AFAICT). This version number I found on some wiki, the link eludes me right now. It appears that newer NDKs don’t work correctly with Lime/OpenFL.

EDIT: And yeah, that was the page I was referring to. I’m unsure which came first, my installation of Android Studio or Haxe/OpenFL. I have been upgrading both Haxe, Haxelibs and Android Studio a number of times since my initial install.
I can’t vouch for how that instructions page works with a clean install (no previous Android Studio/SDK), but it appears to be an easy mistake to open Android Studio/SDK Manager and accidentally upgrade the NDK past what Lime/OpenFL works with.

Yes, that’s correct, the latest NDK compatible with hxcpp right now is r15c as far as I’m aware.

So it’s not so much about the docs being incorrect, but rather missing a note about this. Though arguably lime setup android should mention this, as only Flixel users would be aware of this if we update the docs. Or perhaps hxcpp itself should even implement a warning / error for it, to cover non-Lime projects too…

1 Like

And thank you, singmajesty, for the tip. I’ve so far not been able to get adb over wifi to work with any of my devices, using Haxe or otherwise. Which means I need to tell adb somehow to prefer first USB-connected device.

Can you tell me where you found out about the “–device=” -option? I can’t see it in the help text when I try
lime help test
Which otherwise lists a bunch of options. Thanks!