Unable to build haxe (via OpenFL/lime) to android


#1

All, I’ve searched around for this topic, but I haven’t run into anything that quite fits my situation.

I have a haxeflixel project, using FlashDevelop as my IDE along with lime 2.9.1 and Openfl 3.6.1-LQBZc4.

I’m on Win10. I’m able to compile my project to Windows and to HTML5, but not to the android target.

lime and OpenFL versions:

C:\HaxeToolkit\android>lime --help


/_ \ __
//\ \ /_\ ___ ___ __
\ \ \ /\ \ /’ __\ /’`
_\ _\ \ /\ /\ /\ /\ /
/_
\ _\ _\ _\ _\ _
/
/ /////////____/

Lime Command-Line Tools (2.9.1)
Use lime setup to configure platforms or lime help for more commands

C:\HaxeToolkit\android>openfl --help

.d88 88b. 888888b 888
d88P" "Y88b 888 888
888 888 888 888
888 888 88888b. .d88b. 88888b. 8888888 888
888 888 888 “88b d8P Y8b 888 “88b 888 888
888 888 888 888 88888888 888 888 888 888
Y88b. .d88P 888 d88P Y8b. 888 888 888 888
"Y88 88P” 88888P” "Y8888 888 888 888 "Y888P
888
888

OpenFL Command-Line Tools (3.6.1-LQBZc4)
Use openfl setup to configure platforms or openfl help for more commands
Use -Dv2 or -Dlegacy with your commands to use OpenFL 2.x legacy mode

When I attempt to build using FlashDevelop:

Running process: C:\Program Files (x86)\FlashDevelop\Tools\fdbuild\fdbuild.exe “C:\Users\greed\Content\Personal\game\lst\haxe\lst\lst.hxproj” -ipc 2205808e-00ed-455e-8fd3-6ea8aa60e9d9 -version “3.4.4” -compiler “C:\HaxeToolkit\haxe” -notrace -library “C:\Program Files (x86)\FlashDevelop\Library” -target "android"
Building lst
Running Pre-Build Command Line…
cmd: “C:\HaxeToolkit\haxe/haxelib” run lime build “Project.xml” android -release -Dfdb
Error: You need to run “lime setup android” before you can use the Android target
Build halted with errors.
Done(1)

And when I run lime setup:

C:\HaxeToolkit\android>lime setup android
Download and install the Android SDK? [y/n/a] ? n
Download and install the Android NDK? [y/n/a] ? n
Download and install Apache Ant? [y/n/a] ? n
Download and install the Java JDK? [y/n/a] ? n

Path to Android SDK [c:\SDKs/android-sdk]:
Path to Android NDK [c:\SDKs/android-ndk]:
Path to Apache Ant [c:\SDKs/ant]:
Path to Java JDK [C:\Program Files (x86)\Java\jdk1.8.0_171]:
Called from ? line 1
Called from CommandLineTools.hx line 1400
Called from CommandLineTools.hx line 25
Called from CommandLineTools.hx line 94
Called from CommandLineTools.hx line 1415
Called from utils/PlatformSetup.hx line 406
Called from utils/PlatformSetup.hx line 416
Called from utils/PlatformSetup.hx line 992
Called from utils/PlatformSetup.hx line 2218
Called from /usr/lib/haxe/std/neko/_std/sys/io/File.hx line 54
Uncaught exception - [file_open,C:\Users\greed/.hxcpp_config.xml]

Strange error there.

And my entire .hxcpp_config.xml:

 <!-- Use this to control the SDK used when compiling for iphone/iphonesim, and the
       default is not found, or you wish to use a specific version -->
 <!-- <set name="IPHONE_VER" value="4.2" /> -->

 <!-- If you put all your SDKs in one directory, then you can just set this
      single variable.  If you put them in exactly this place, then you should not
      need to setup anything ! -->
 <set name="SDK_ROOT" value="c:\SDKs\" unless="SDK_ROOT" if="windows" />
 <set name="SDK_ROOT" value="${HOME}/SDKs/" unless="SDK_ROOT" />
 <!-- If you want to control how many compilers get spawned .
      The default will use the number of processors.
      Reducing this to 1 can help deciphering error messages. -->
 <!-- <set name="HXCPP_COMPILE_THREADS" value="1" /> -->

 <!-- Add this if your compiler does not support precompiled headers -->
 <!-- <set name="NO_PRECOMPILED_HEADERS" value="1"/> -->

 <!-- Older versions of gcc do not suport the @file syntax for an obj file list
      and precompiled headers.  Set this if you have these issues -->
 <!-- <set name="GCC_OLD" value="1" /> -->

 <!-- Skip the "stripping" phase.  This will leave extra symbols in you exe, which
      may allow reverse engineering and larger file sizes.  You might want to do
      this to debug some problems though. -->
 <!-- <set name="nostrip" value="1" /> -->

 <!-- Let the system detect the latest version of MSVC on windows
      (otherwise must setup the environment yourself) -->
 <!-- Disable with <set name="NO_AUTO_MSVC" value="1" /> -->
 <!-- To disable specific versions: <setenv name="VS110COMNTOOLS" value="disable" /> -->

Any advice? Much appreciated, folks.


#2

Are “C:\SDKs\android-sdk”, “C:\SDKs\android-ndk” and “C:\SDKs\ant” valid paths? Did you install the Android platform tools and SDK packages already? Do you have USB drivers for your Android phone installed already? If you have a recent version of Android, you also need a newer Android NDK (such as NDK r13b+)


#3

I don’t see how those paths would be the issue, when the error came from [file_open,C:\Users\greed/.hxcpp_config.xml]. That is, it crashed because it couldn’t open .hxcpp_config.xml.

Can you double-check that that file is located in C:\Users\greed? If so, then maybe some other program is blocking access, or Windows has decided that only administrators can open it, or something.

What I would do is rename the old file, create a brand-new file named .hxcpp_config.xml, and copy the text over. Also maybe restart the computer and update Lime.

Failing that, make a totally new file in a different location, and set the HXCPP_CONFIG environment variable to point there instead.


#5

Thanks to the both of you. Sorry for the delay; been tied up.

Tried some stuff and now I’m getting a different sort of issue (but one that might be easier to solve…?). I’m getting no confirmation/error from lime setup android (as opposed to not being able to read the hx config file), and I’m still unable to build to Android.

I was using NDK r8b, but I’ve upgraded NDK to r18b, the latest stable at the moment.

I set up a copy of the .hxcpp_config to .hxcpp_configCopy.xml and updated the environment variable, but I was still receiving the same error… about not being able to open C:\Users\greed.hxcpp_config.xml. Strange. And so I set it back to C:\Users\greed.hxcpp_config.xml.

But I think that’s immaterial now.

I then tried removing the .hxcpp_config (made a backup, of course) and allowing the lime setup android command to generate it from scratch, and I’ve now gotten a bit further.

lime setup android gives me the following:

C:\WINDOWS\system32>lime setup android

Download and install the Android SDK? [y/n/a] ? n
Download and install the Android NDK? [y/n/a] ? n
Download and install Apache Ant? [y/n/a] ? n
Download and install the Java JDK? [y/n/a] ? n

Path to Android SDK []: c:\SDKs/android-sdk
Path to Android NDK []: c:\SDKs/android-ndk-r18b
Path to Apache Ant []: c:\SDKs/ant
Path to Java JDK []: C:\Program Files (x86)\Java\jdk1.8.0_171

C:\WINDOWS\system32>

That is, it exits with no error, no confirmation, no nothing.

Here’s what the .hxcpp_config looks like now:

But when compiling in FlashDevelop, I get the same messages as before:

Running process: C:\Program Files (x86)\FlashDevelop\Tools\fdbuild\fdbuild.exe “C:\Users\greed\Files\Personal\Software\Games\lst\haxe\lst.hxproj” -ipc 483c9da4-ba30-4098-a2b3-c089a0184112 -version “3.4.4” -compiler “C:\HaxeToolkit\haxe” -notrace -library “C:\Program Files (x86)\FlashDevelop\Library” -target "android"
Building lst
Running Pre-Build Command Line…
cmd: “C:\HaxeToolkit\haxe/haxelib” run lime build “Project.xml” android -release -Dfdb

Error: You need to run “lime setup android” before you can use the Android target
Build halted with errors.
Done(1)

That is, it doesn’t detect that I’ve set the thing up.

The paths I’m using do exist:

C:\WINDOWS\system32>dir \SDKs
Volume in drive C is Windows
Volume Serial Number is 946A-741F

Directory of C:\SDKs

05/06/2018 03:31 PM .
05/06/2018 03:31 PM …
04/18/2018 02:25 PM android-ndk
05/06/2018 03:31 PM android-ndk-r16b
04/22/2018 09:35 PM android-sdk
04/18/2018 01:53 PM ant

That’s with lime 2.9.1, the version I’d been using. So I upgraded lime, but Flixel tells me to roll it back.

Running process: C:\Program Files (x86)\FlashDevelop\Tools\fdbuild\fdbuild.exe “C:\Users\greed\Files\Personal\Software\Games\lst\haxe\lst.hxproj” -ipc 483c9da4-ba30-4098-a2b3-c089a0184112 -version “3.4.4” -compiler “C:\HaxeToolkit\haxe” -notrace -library “C:\Program Files (x86)\FlashDevelop\Library” -target "android"
Building lst
Running Pre-Build Command Line…
cmd: “C:\HaxeToolkit\haxe/haxelib” run lime build “Project.xml” android -release -Dfdb
C:/HaxeToolkit/haxe/lib/flixel/4,3,0/flixel/system/macros/FlxDefines.hx:100: characters 51-55 : Please run ‘haxelib set lime 2.9.1’ (Flixel is currently incompatible with Lime 3.0.0 or newer).

And so I may be stuck with the old lime.

Any advice? Yet again, I appreciate it.


#6

Do you mean r16b? I don’t think r18b is a thing yet. :slight_smile: Personally I had some issues even with r16b, downgradiang to r15c helped.

There should be two configs in your home directory: .hxcpp_config.xml and .lime/config.xml. Just to be safe, both should have something like this:

<set name="ANDROID_SETUP" value="true" />
<set name="ANDROID_NDK_ROOT" value="C:\Android\NDK\r13b" />
<set name="ANDROID_SDK" value="C:\Android\SDK" />

You can just set the paths manually.

Update Flixel to 4.4.0.


#7

Update Flixel to 4.4.0.4

You know, I should have thought to actually upgrade software. This fixed that problem.

My next is just a simple inclusion/library problem…

Running process: C:\Program Files (x86)\FlashDevelop\Tools\fdbuild\fdbuild.exe “C:\Users\greed\Files\Personal\Software\Games\lst\haxe\lst.hxproj” -ipc 483c9da4-ba30-4098-a2b3-c089a0184112 -version “3.4.4” -compiler “C:\HaxeToolkit\haxe” -notrace -library > “C:\Program Files (x86)\FlashDevelop\Library” -target "android"
Building lst
Running Pre-Build Command Line…
cmd: “C:\HaxeToolkit\haxe/haxelib” run lime build “Project.xml” android -release -Dfdb
Creating C:/Users/greed/Files/Personal/Software/Games/lst/haxe/export/android/obj/obj/android-v7/__pch/haxe/hxcpp.h.gch…
In file included from C:/HaxeToolkit/haxe/lib/hxcpp/3,4,188/include/hxcpp.h:20:0:
c:\sdks\android-ndk\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\lib\gcc\arm-> linux-androideabi\4.9.x\include\stdint.h:9:26: fatal error: stdint.h: No such file or directory
# include_next <stdint.h>
^
compilation terminated.
Error: Could not create PCH
Build halted with errors.
Done(1)

I don’t know if it’s related, but it looks like that’s another topic.

Thanks again!