Cannot set up Android, can't find a solution elsewhere online

Hi there.
I installed the NDK, SDK, Ant, and had a jdk (1.8) floating around. ‘openfl setup android’ didn’t give me any errors. However, when I compile for android in FlashDevelop, it says:

'arm-linux-androideabi-g++' is not recognized as an internal or external command, operable program or batch file. Error: Could not create PCH Build halted with errors.

a search for ‘arm-linux-androideabi’ returns a file with lots of .o files, but nothing mentioning g++. By the way, my C++ compiler is MinGW, and of course doesn’t mention linux or android. I also tried compiling with ‘openfl build android’, but it gave me the first result. So after lots of online searching, I tried to compile my project on the command line using ‘lime build android -emulator’.

Creating C:/Users....../__pch/haxe/hxcpp.h.gch... C:/HaxeToolkit......./hxcpp/3,4,2/include/hxcpp.h:19:23: fatal error: typeinfo: No such file or directory #include <typeinfo> ^ compilation terminated Error: Could not create PCH

I run in the same problem. Try to find solution (I read almost all posts about this issue ) to compile it to Android but without success. I’m not sure where to start? I will really appreciate if someone can guide us to find solution for this problem. Thanks.

Sorry that openfl setup and the instructions are not necessarily up-to-date, this changed recently with the move from Ant to Gradle for Android builds

Does this help?

Alright, I installed Gradle and it appears to be working. I downloaded the API 25 (I had API 19 installed before), but I still get the same errors.

On a different note, I found another installation of the SDK and NDK in my program files. ‘arm-linux-androidebi-g++.exe’ is there, hopefully where it’s supposed to be. I DID run ‘openfl setup android’ and changed the paths, but I STILL get the error that the file isn’t found.

Double check that you don’t have a “C:\Users(Your User Name).hxcpp_config.xml” file with different values for the Android NDK than your “C:\Users(Your User Name).lime\config.xml”

If HXCPP sees a different value (Lime should forward it’s values to HXCPP if it doesn’t have it’s own define there) then it could break on the build step

That was it. Deleted and ran setup again, worked like a charm. Thanks a ton!

I still don’t get it what’s wrong in my configuration:
hxcpp_config

and lime_config:

Whatever I change, result is always the same:
‘arm-linux-androideabi-g++’ is not recognized as an internal or external command…

Folder structure with SDK:

OK, I solve problem by downloading new version of Android NDK (android-ndk-r13b) from official site. Update lime paths and that is it. Successful build and run on android.

1 Like

Hi, i have a similar problem because i trying to update the sdk ndk and java like lime told… i install all from the android studio and put the respective path for each one of them and i already look into the file .hxcpp_config.xml and change the folders too … i dont now what to do… i am getting this error with a example of openfl:

I have the same issue. Same error.

On Mac and used Android Studio

actuate: [1.8.7]
box2d: [1.2.3]
format: [3.4.1]
hxcpp: [git]
layout: [1.2.1]
lime-samples: [6.2.0]
lime: [6.4.0]
openfl-samples: [6.0.0]
openfl: [8.3.0]

This fixed it for me :
Android NDK, Revision 15c (July 2017)
https://developer.android.com/ndk/downloads/older_releases?hl=ko#ndk-15c-downloads

Also be sure these file match for SDK and NDK paths
Files:
.hxcpp_config.xml
.lime/config.xml
XML nodes:

     <set name="ANDROID_SETUP" value="true" />
     <set name="ANDROID_NDK_ROOT" value="/Volumes/Home/Work/___NDK/android-ndk-r15c" />
     <set name="ANDROID_SDK" value="/Volumes/Home/Library/Android/sdk" />
1 Like

Note: lime config is another way to edit your ~/.lime/config.xml file

# Print your current config file
lime config

# Print a current config variable
lime config ANDROID_NDK_ROOT

# Set the value of a config variable
lime config ANDROID_NDK_ROOT C:\Development\Android\android-ndk-r15c

# Automate walking through config variables related to Android
lime setup android

EDIT: If ~/.hxcpp_config.xml has ANDROID_NDK_ROOT, it takes preference at the C++ compilation stage, so either you need to remove it from that file, or make sure it reflects the correct NDK value, like your Lime config file :slight_smile:

Hello,
i am having a similar issue.
when runninh openfl test android
im am getting
sh: arm-linux-androideabi-g++: command not found **Error:** **Could not create PCH**

my ndk is v20
all the paths in the configs are correct.
Any ideas?

Try NDK r15c

HXCPP currently expects a GCC toolchain which was removed from the newer NDKs. I tried adding clang support but it needs a little bit more work before it will work https://github.com/HaxeFoundation/hxcpp/pull/707