Error when compiling to android

If I try to target android, I get this error:

Error: (- Compiling src/ApplicationMain.cpp) arm-linux-androideabi-g++ -Iinclude --sysroot=/opt/android-ndk/platforms/android-9/arch-arm -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=321 -I/usr/lib/haxe/lib/hxcpp/3,2,102/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums "-D_LINUX_STDDEF_H " -Wno-psabi -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID=ANDROID -DHX_ANDROID -DHXCPP_ANDROID_PLATFORM=14 -Wa,–noexecstack -O2 -DNDEBUG -c -x c++ -Wno-invalid-offsetof -frtti ./src/ApplicationMain.cpp -oobj/android-v7/82b53a69_ApplicationMain.obj

Any one can help? I have openfl 3.3.8, lime 2.6.8 and haxe 3.2.0

Ok, I found that android API that I am targeting is not installed, I will install it now :blush:

I have installed android API 14, but I still have this error:

Error: (- Compiling src/ApplicationMain.cpp) arm-linux-androideabi-g++ -Iinclude --sysroot=/opt/android-ndk/platforms/android-9/arch-arm -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=321 -I/usr/lib/haxe/lib/hxcpp/3,2,102/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums "-D_LINUX_STDDEF_H " -Wno-psabi -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID=ANDROID -DHX_ANDROID -DHXCPP_ANDROID_PLATFORM=14 -Wa,–noexecstack -O2 -DNDEBUG -c -x c++ -Wno-invalid-offsetof -frtti ./src/ApplicationMain.cpp -oobj/android-v7/82b53a69_ApplicationMain.obj

Do I still missing something?

Is it the entire error message?

Do you have the latest android API installed too?

Yes, this is the entire error message, kindly see the attached pic

Sometimes the actual error is printed earlier on; could you post the entire compilation log?

I will post the entire log when I go home, I hope to fix it tonight, thanks

Ok, here is the full compilation log:

mac:client Apple$ /usr/lib/haxe/haxelib run lime build /Users/Apple/Documents/projects/idea/client/client/idea-client.xml android -verbose
___ idea
/_ \ __
//\ \ /_\ ___ ___ __
\ \ \ /\ \ /’ __\ /’`\
_\ _\ \ /\ /\ /\ /\ /
/_
\ _\ _\ _\ _\ _
/
/ /////////____/

Lime Command-Line Tools (2.6.8)

Initializing project…
Using project file: /Users/Apple/Documents/projects/idea/client/client/idea-client.xml
Reading HXCPP config: /Users/Apple/.hxcpp_config.xml
Using target platform: ANDROID

Running command: UPDATE

  • Running command: haxelib run swf process /var/folders/8g/p8wtd8g17z973rpjrz5dx4_h0000gn/T//temp_10893963 /var/folders/8g/p8wtd8g17z973rpjrz5dx4_h0000gn/T//temp_6191885 -verbose --targetDirectory=/Users/Apple/Documents/projects/idea/client/client/Export/android
  • Detected host architecture: X64
  • Processing library: Assets/compact-ideas-assets-cc.swf [SWFLite]
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/dependencies/extension-api/AndroidManifest.xml -> Export/android/bin//deps/extension-api/AndroidManifest.xml
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/dependencies/extension-api/build.xml -> Export/android/bin//deps/extension-api/build.xml
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/dependencies/extension-api/project.properties -> Export/android/bin//deps/extension-api/project.properties
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/dependencies/extension-api/src/org/haxe/extension/Extension.java -> Export/android/bin//deps/extension-api/src/org/haxe/extension/Extension.java
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/dependencies/extension-api/src/org/haxe/HXCPP.java -> Export/android/bin//deps/extension-api/src/org/haxe/HXCPP.java
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/dependencies/extension-api/src/org/haxe/lime/HaxeObject.java -> Export/android/bin//deps/extension-api/src/org/haxe/lime/HaxeObject.java
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/dependencies/extension-api/src/org/haxe/lime/Lime.java -> Export/android/bin//deps/extension-api/src/org/haxe/lime/Lime.java
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/dependencies/extension-api/src/org/haxe/lime/Value.java -> Export/android/bin//deps/extension-api/src/org/haxe/lime/Value.java
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/template/AndroidManifest.xml -> Export/android/bin//AndroidManifest.xml
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/template/build.xml -> Export/android/bin//build.xml
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/template/libs/armeabi/readme.txt -> Export/android/bin//libs/armeabi/readme.txt
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/template/project.properties -> Export/android/bin//project.properties
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/template/src/org/haxe/lime/GameActivity.java -> Export/android/bin//src/org/haxe/lime/GameActivity.java
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/template/src/org/libsdl/app/SDLActivity.java -> Export/android/bin//src/org/libsdl/app/SDLActivity.java
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/MainActivity.java -> Export/android/bin//src/com/idea/MainActivity.java
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/haxe/ApplicationMain.hx -> Export/android/haxe/ApplicationMain.hx
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/haxe/DefaultAssetLibrary.hx -> Export/android/haxe/DefaultAssetLibrary.hx
  • Copying template file: /usr/lib/haxe/lib/openfl/3,3,8/templates/haxe/ApplicationMain.hx -> Export/android/haxe/ApplicationMain.hx
  • Copying template file: /usr/lib/haxe/lib/openfl/3,3,8/templates/haxe/NMEPreloader.hx -> Export/android/haxe/NMEPreloader.hx
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/hxml/debug.hxml -> Export/android/haxe/debug.hxml
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/hxml/final.hxml -> Export/android/haxe/final.hxml
  • Copying template file: /usr/lib/haxe/lib/lime/2,6,8/templates/android/hxml/release.hxml -> Export/android/haxe/release.hxml

Running command: BUILD

  • Copying library file: /usr/lib/haxe/lib/hxcpp/3,2,102/bin/Android/libstd-v7.so -> Export/android/bin/libs/armeabi/libstd.so
  • Copying library file: /usr/lib/haxe/lib/hxcpp/3,2,102/bin/Android/libregexp-v7.so -> Export/android/bin/libs/armeabi/libregexp.so
  • Copying library file: /usr/lib/haxe/lib/hxcpp/3,2,102/bin/Android/libzlib-v7.so -> Export/android/bin/libs/armeabi/libzlib.so
  • Copying library file: /usr/lib/haxe/lib/lime/2,6,8/ndll/Android/liblime-v7.so -> Export/android/bin/libs/armeabi/liblime.so
  • Running command: haxe Export/android/haxe/release.hxml -D android -D android-9 -D HXCPP_ARMV7
  • Changing directory: Export/android/obj
  • Running command: haxelib run hxcpp Build.xml -DHXCPP_ARMV7=1 -Dactuate=1.8.6 -Dandroid=1 -Dandroid-9=1 -Dandroid_9=1 -Dassetsmanager=1.2.0 -Dcereal=0.0.4 -Dhaxe3=1 -Dhaxe_ver=3.2 -Dhscript=2.0.5 -Dhxcpp_api_level=321 -Dlime=2.6.8 -Dlime-cairo=1 -Dlime-curl=1 -Dlime-native=1 -Dlime-openal=1 -Dlime-opengl=1 -Dlime_cairo=1 -Dlime_curl=1 -Dlime_native=1 -Dlime_openal=1 -Dlime_opengl=1 -Dmlib=2.0.2 -Dmobile=1 -Dmsignal=1.2.2 -Dnative=1 -Dopenfl=3.3.8 -Dopenfl-native=1 -Dopenfl-next=1 -Dopenfl_native=1 -Dopenfl_next=1 -Drox-i18n=1.0.0 -Drox_i18n=1.0.0 -Dstablexui=1.1.5 -Dsvg=1.0.8 -Dswf=2.1.1 -Dtools=2.6.8 -Dandroid -Dandroid-9 -DHXCPP_ARMV7 -verbose
    __
    /\ \
    \ \ ___ __ _ ___ _____ _____
    \ \ _ \ /\ \/'\ /'___\/\ '__/\ '`\
    \ \ \ \ \/> <//\ _/\ \ \L\ \ \ \L\
    \ _\ _/_/_\ _
    \ \ ,/\ \ ,/
    /////////_/ \ \ / \ \ /
    \ _\ \ _\
    /
    / /
    /

hxcpp (Haxe C++ Runtime Support) (3.2.102)

Using makefile: Build.xml
Reading HXCPP config: /Users/Apple/.hxcpp_config.xml
No specified toolchain

  • Parsing include: /usr/lib/haxe/lib/hxcpp/3,2,102/toolchain/setup.xml
  • Parsing include: /Users/Apple/.hxcpp_config.xml (section “vars”)
  • Parsing include: /usr/lib/haxe/lib/hxcpp/3,2,102/toolchain/finish-setup.xml
  • Parsing makefile: Build.xml
  • Parsing include: /usr/lib/haxe/lib/hxcpp/3,2,102/build-tool/BuildCommon.xml
  • Parsing include: /usr/lib/haxe/lib/hxcpp/3,2,102/toolchain/haxe-target.xml
  • Parsing include: /usr/lib/haxe/lib/hxcpp/3,2,102/toolchain/android-toolchain.xml

Using Android NDK root: /opt/android-ndk
Detected Android NDK r8
Detected Android toolchain: arm-linux-androideabi-4.4.3
Detected Android host: darwin-x86
Using newest Android NDK platform: 14

  • Adding path: /opt/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin
  • Parsing include: /usr/lib/haxe/lib/hxcpp/3,2,102/toolchain/gcc-toolchain.xml
  • Parsing compiler: /usr/lib/haxe/lib/hxcpp/3,2,102/toolchain/common-defines.xml
  • Parsing include: /Users/Apple/.hxcpp_config.xml (section “exes”)

Using compile threads: 4

  • Compiling src/ApplicationMain.cpp : arm-linux-androideabi-g++ -Iinclude --sysroot=/opt/android-ndk/platforms/android-9/arch-arm -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=321 -I/usr/lib/haxe/lib/hxcpp/3,2,102/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums "-D_LINUX_STDDEF_H " -Wno-psabi -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID=ANDROID -DHX_ANDROID -DHXCPP_ANDROID_PLATFORM=14 -Wa,–noexecstack -O2 -DNDEBUG -c -x c++ -Wno-invalid-offsetof -frtti ./src/ApplicationMain.cpp -oobj/android-v7/82b53a69_ApplicationMain.obj
  • Copying file: Export/android/obj/libApplicationMain-v7.so -> Export/android/bin/libs/armeabi/libApplicationMain.so
  • Changing directory: Export/android/bin
  • Running command: /opt/apache-ant/bin/ant debug
    Buildfile: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 22.0.5
[checkenv] Installed at /opt/android-sdk

-setup:
[echo] Project Name: DC AC Lab
[gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 19.1.0
[echo] Resolving Build Target for DC AC Lab…
[gettarget] Project Target: Android 4.0
[gettarget] API level: 14
[echo] ----------
[echo] Creating output directories if needed…
[echo] ----------
[echo] Resolving Dependencies for DC AC Lab…
[dependency] Library dependencies:
[dependency]
[dependency] ------------------
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
[echo] ----------
[echo] Building Libraries with ‘debug’…

nodeps:

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 22.0.5
[checkenv] Installed at /opt/android-sdk

-setup:
[echo] Project Name: OpenFLExtension
[gettype] Project Type: Android Library

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 19.1.0
[echo] Resolving Build Target for OpenFLExtension…
[gettarget] Project Target: Android 4.0
[gettarget] API level: 14
[gettarget] WARNING: No minSdkVersion value set. Application will install on all Android versions.
[echo] ----------
[echo] Creating output directories if needed…
[echo] ----------
[echo] Resolving Dependencies for OpenFLExtension…
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.

-code-gen:
[mergemanifest] Found modified input file
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files…
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files…
[renderscript] No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources…
[aapt] Found modified input file
[aapt] Generating resource IDs…
[echo] ----------
[echo] Handling BuildConfig class…
[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
[javac] Compiling 5 source files to /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/deps/extension-api/bin/classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] 3 warnings
[echo] Creating library output jar file…
[jar] Building jar: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/deps/extension-api/bin/classes.jar

-post-compile:

-obfuscate:

-dex:
[echo] Library project: do not convert bytecode…

-crunch:
[crunch] Crunching PNG Files in source dir: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/deps/extension-api/res
[crunch] To destination dir: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/deps/extension-api/bin/res
[crunch] Crunched 0 PNG files to update cache

-package-resources:
[echo] Library project: do not package resources…

-package:
[echo] Library project: do not package apk…

-post-package:

-do-debug:
[echo] Library project: do not create apk…
[propertyfile] Updating property file: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/deps/extension-api/bin/build.prop
[propertyfile] Updating property file: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/deps/extension-api/bin/build.prop
[propertyfile] Updating property file: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/deps/extension-api/bin/build.prop
[propertyfile] Updating property file: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/deps/extension-api/bin/build.prop

-post-build:

debug:

-code-gen:
[mergemanifest] Found modified input file
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Merging manifests from project and 1 libraries.
[echo] Handling aidl files…
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files…
[renderscript] No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources…
[aapt] Found modified input file
[aapt] Generating resource IDs…
[echo] ----------
[echo] Handling BuildConfig class…
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
[javac] Compiling 5 source files to /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/bin/classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/src/org/haxe/lime/GameActivity.java:217: error: cannot find symbol
[javac] getWindow ().getDecorView ().setSystemUiVisibility (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN);
[javac] ^
[javac] symbol: variable SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
[javac] location: class View
[javac] /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/src/org/haxe/lime/GameActivity.java:217: error: cannot find symbol
[javac] getWindow ().getDecorView ().setSystemUiVisibility (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN);
[javac] ^
[javac] symbol: variable SYSTEM_UI_FLAG_LAYOUT_STABLE
[javac] location: class View
[javac] /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/src/org/haxe/lime/GameActivity.java:217: error: cannot find symbol
[javac] getWindow ().getDecorView ().setSystemUiVisibility (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN);
[javac] ^
[javac] symbol: variable SYSTEM_UI_FLAG_FULLSCREEN
[javac] location: class View
[javac] Note: /Users/Apple/Documents/projects/idea/client/client/Export/android/bin/src/org/libsdl/app/SDLActivity.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 3 errors
[javac] 3 warnings

BUILD FAILED
/opt/android-sdk/tools/ant/build.xml:712: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:726: Compile failed; see the compiler error output for details.

Total time: 5 seconds

That seems to be an entirely different error than the one you posted earlier.

Also, it turns out SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN was added in API 16 (along with those other flags causing errors). Why not target 16 instead of 14?

Thanks for the suggestion, I have targeted API 16, and it has compiled successfully :smile:

By the way, the previous error was by the compilation log in Intellij IDE using haxe add-on, the log was different when I used a terminal, although I have used the same command used in Intellij IDE…

Any way, I can compile now using API 16, thanks

Although I was able to compile, but swf libraries will not load,
When I try to load them like this:

<library path="Assets/compact-dcaclabs-assets-cc.swf" id="Compo" preload="false" />
<library path="Assets/led.swf" id="Led" preload="false" />

Assets.loadLibrary (“Compo”, function () {
Assets.loadLibrary (“Led”, function (
) {
Main.instance.start();
});
});

It will cause this error in the log:

I/trace (28760): Assets.hx:413: [Assets] There is no String asset with an ID of "libraries/Compo.json"
I/trace (28760): Assets.hx:413: [Assets] There is no String asset with an ID of “libraries/Led.json”

So, do I have to use preload=“true” when using android?