Android Development



  • Can someone PLEASE do a complete(or as much as they can remember), complete list of steps they took to getting a game working on their android device? Be it a phone or tablet? I'm trying to build to android and am getting errors within the android sdk tools ant build.xml and I've no idea what the problem is or what more steps I need to take.

    Trying to compile to android has been super frustrating.



  • @xhunterko

    I will try.

    Which NDK are you using? I'm using r9 but might work with r11 or higher, not sure.

    Open SDK Manager and check istalled versions.

    This is my installation:
    Note: I should probably try updating these, but it works.
    (newer versions are available. Sometimes the latest version is problematic)

    Android SDK Build-tools 23.0.3
    Android SDK Platform-tools 24
    Android SDK Tools 25.1.7
    API 19 and API 23

    I also have Extras installed:
    Android Support Repository
    Google Repository

    Java:
    Version 8
    jdk1.8.0_121

    In your user folder you should have hxcpp_config.xml and here's what mine looks like.

    <xml>
    
    	<section id="vars">
    		
    		<set name="ANDROID_SETUP" value="true" />
    		<set name="ANDROID_NDK_ROOT" value="C:\Development\android-ndk-r9d" />
    		<set name="ANDROID_SDK" value="C:\Development\Android SDK" />
    		<set name="ANT_HOME" value="C:\Development\Apache Ant" />
    		<set name="JAVA_HOME" value="C:\Program Files\Java\jdk1.8.0_121" />
    		
    	</section>
    
    </xml>
    

    I've never had luck with the emulators. I always test on my phone or tablet.

    Hope this helps. I had problems getting it set up too. If I remember, the problem I had was when I used the android setup command it was installing an out of date NDK.

    It would be helpful if you post more info and errors and about your setup.



  • You can download different NDK versions and edit hxcpp_config.xml to change the version.
    NDK Downloads

    Try getting it working with a simple test project first until it compiles successfully.



  • ~The answer is I don't know and now I've broken everything and I don't know how to fix it.

    I was getting something? Some sort of error after downloading and installing maybe missing tools maybe? And was getting something about things in the asset path not being right or some nonsense.

    Then while in my c: users\me folder on the command line I stupidly time haxelib setup android.

    I get new folder created and command line path set to new folder. I try to compile in flash develop and get errors. haxelib gives no such project: android if I go haxelib install android. I've no idea what I've done here.

    Help.~

    Okay. I think I fixed that. As far as what I have

    Android SDK Build-tools 19.1
    Android SDK Platform-tools 24.0.3
    Android SDK Tools 22.0.5
    API 19 and API 24

    I also have Extras installed:
    Android Support Repository
    Google Repository

    Java:
    Version 7
    jdk1.7.0_79
    and
    jdk1.6.0_45

     <section id="vars">
    	
    	<set name="ANDROID_SETUP" value="true" />
    	<set name="ANDROID_NDK_ROOT" value="C:\Development\Android NDK" />
    	<set name="ANDROID_SDK" value="C:\Development\Android SDK" />
    	<set name="ANT_HOME" value="C:\Development\Apache Ant" />
    	<set name="SDK_ROOT" value="C:\Program Files\Android\Android Studio" />
    	<set name="JAVA_HOME" value="C:\Program Files\Java\jdk1.6.0_45" />
    	
    </section>
    

    In my own project, I'm getting it to build but I'm getting asset path errors such as this:

    Error: While running :arm-linux-androideabi-g++ -IC:/Users/Robert/Desktop/LockerRaid/export/android/obj/obj/android-debug-v7/__pch/haxe -Iinclude "--sysroot=C:\Development\Android NDK/platforms/android-9/arch-arm" "-IC:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include" "-IC:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include" -DHXCPP_DEBUG -DHXCPP_VISIT_ALLOCS -DHXCPP_CHECK_POINTER -DHXCPP_API_LEVEL=321 -IC:/haxelib/hxcpp/3,3,49/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums "-D_LINUX_STDDEF_H " -Wno-psabi -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=9 -Wa,--noexecstack -O0 -g -DNDEBUG -c -x c++ -Wno-invalid-offsetof -frtti ./src/AssetPaths.cpp -oC:/Users/Robert/Desktop/LockerRaid/export/android/obj/obj/android-debug-v7/bc46c1db_AssetPaths.obj
    In file included from ./src/AssetPaths.cpp:4:
    include/AssetPaths.h:50: error: expected identifier before numeric       constant
    include/AssetPaths.h:50: error: expected ',' or '...' before numeric    constant
    include/AssetPaths.h:50: error: expected ';' before '__png'
    

    ./src/AssetPaths.cpp:63: error: 'String AssetPaths_obj::WallSet' is not a static member of 'class AssetPaths_obj'
    ./src/AssetPaths.cpp:63: error: expected ',' or ';' before '__png'
    ./src/AssetPaths.cpp: In function 'void sMarkStatics(hx::MarkContext*)':
    ./src/AssetPaths.cpp:124: error: 'WallSet' is not a member of 'AssetPaths_obj'
    ./src/AssetPaths.cpp: In function 'void sVisitStatics(hx::VisitContext*)':
    ./src/AssetPaths.cpp:151: error: 'WallSet' is not a member of 'AssetPaths_obj'
    ./src/AssetPaths.cpp: In static member function 'static void AssetPaths_obj::__boot()':
    ./src/AssetPaths.cpp:231: error: 'WallSet' was not declared in this scope
    ./src/AssetPaths.cpp:231: error: expected ';' before '__png'
    Build halted with errors (haxelib.exe).

    No idea where to fix it. I should probably check those android folders to see what needs to be changed or installed too.

    With Mode, I get these errors here:

    BUILD FAILED
    C:\Development\Android SDK\tools\ant\build.xml:884: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:886: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:898: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:281: null returned: 1

    So. What next then?



  • @xhunterko

    After you make changes to your android setup you should delete the android export folder for a clean build and build.xml will be recreated.

    One other thing to check is your haxe version. I'm using 3.2.0.



  • @xhunterko

    Did you check your NDK version? Look at C:\Development\Android NDK\RELEASE.TXT for the version. I'm not sure of the latest compatible version, but I'm using r9d (64-bit). You might try a newer version, say r13, EDIT: r13 failed and change the path in hxcpp_config.xml. I'm using an older version because of an extension I'm using requires it.

    Maybe someone else knows the latest compatible versions for all of the android setup to work with HF?



  • @xhunterko

    I decided to update my NDK

    I've been using android-ndk-r9d, but looks like they don't go back that far for download. I got it > year ago.

    This is what I found:

    android-ndk-r9d works
    android-ndk-r11c works
    android-ndk-r12 fails
    android-ndk-r13b fails

    Also

    Which version of Visual C++ are you using? I'm using Visual C++ 2010 Express. Again, not sure about later versions, but I don't think recent versions work.



  • Just noticed in the SDK Manager I have API 16 installed too.



  • Make sure you have 3 segments for package in project.xml.
    <meta title="App Title" package="com.yourdomain.AppTitle" version="0.1.4" />

    Can't think of anything else. Hope you get it working.



  • Well I changed around my hxcpp xml to:

    <section id="vars">

    	<set name="ANDROID_SETUP" value="true" />
    	<set name="ANDROID_NDK_ROOT" value="C:\Development\android-ndk-r8b" />
    	<set name="ANDROID_SDK" value="C:\Development\Android SDK" />
    	<set name="ANT_HOME" value="C:\Development\Apache Ant" />
    	<set name="SDK_ROOT" value="C:\Program Files\Android\Android Studio" />
    	<set name="JAVA_HOME" value="C:\Program Files\Java\jdk1.7.0_79" />
    	
    </section>
    

    And now I'm getting this:

    'arm-linux-androideabi-g++' is not recognized as an internal or external command,
    operable program or batch file.
    Error: error running arm-linux-androideabi-g++ -Iinclude --sysroot=C:\Development\android-ndk-r9d/platforms/android-9/arch-arm -IC:\Development\android-ndk-r9d/sources/cxx-stl/gnu-libstdc++//include -IC:\Development\android-ndk-r9d/sources/cxx-stl/gnu-libstdc++//libs/armeabi/include -DHXCPP_DEBUG -DHXCPP_VISIT_ALLOCS -DHXCPP_CHECK_POINTER -DHXCPP_API_LEVEL=321 -IC:/haxelib/hxcpp/3,3,49/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums "-D_LINUX_STDDEF_H " -Wno-psabi -DHXCPP_CPP11 -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=9 -Wa,--noexecstack -O0 -g -DNDEBUG -c -Wno-invalid-offsetof -frtti -std=c++11 -o C:/Users/Robert/Desktop/LockerRaid/export/android/obj/obj/android-debug-v7/__pch/haxe/hxcpp.h.gch C:/haxelib/hxcpp/3,3,49/include/hxcpp.h
    Build halted with errors (haxelib.exe).

    I've seen this error before and this is usually as far as I get.



  • Well hey now I'm getting:

    Unable to resolve project target 'android-17'

    Anyone get that at all and fix it?



  • Well, I downloaded some things from the SDK manager and now I'm getting:

    BUILD FAILED
    C:\Development\Android SDK\tools\ant\build.xml:892: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:894: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:906: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:283: null returned: 1

    I've seen this before and there are other solutions but I don't know if any will work for me cause they may have been tool or software specific? Anyone have any idea of what to do here?



  • @xhunterko

    Maybe the <set name="SDK_ROOT" value="C:\Program Files\Android\Android Studio" /> is a problem. I don't have that in mine.

    Try this.

    • Download and unzip this to C:\Development\
      android-ndk-r11c

    • Remove the <set name="SDK_ROOT" value="C:\Program Files\Android\Android Studio" /> from hxcpp_config.xml.

    • Change NDK path to <set name="ANDROID_NDK_ROOT" value="C:\Development\android-ndk-r11c" />

    • Open SDK Manager and make sure these are installed:
      Android SDK Build-tools 23.0.3
      Android SDK Platform-tools 24
      Android SDK Tools 25.1.7
      API 16, API 19 and API 23

    • Delete, or rename export folder for a clean build.

    I hope it works. I'm out of gas.



  • The Android Studio install may, or may not be the problem. If you are using it, then is the other folder Development even used? This is the one difference I know I have. I never installed Android Studio.

    EDIT: I found this on openfl forum and makes me think Android Studio is your problem. See player_03 comment.



  • @dean said in Android Development:

    The Android Studio install may, or may not be the problem. If you are using it, then is the other folder Development even used? This is the one difference I know I have. I never installed Android Studio.

    EDIT: I found this on openfl forum and makes me think Android Studio is your problem. See player_03 comment.

    No, I'm not using Android Studio. Working on downloading the other stuff. Will report back eventually.

    I'm using FlashDevelop. Do I need to change anything specific in it's settings?



  • @xhunterko

    In your hxcpp_config.xml you have <set name="SDK_ROOT" value="C:\Program Files\Android\Android Studio" /> so something set that. You should take it out of the file at least.

    FlashDevelop shouldn't need anything.



  • Okay. May have to take a break from this and return to it later.

    Thanks again.

    If anyone else has any tips or tricks or has successfully compiled to android then by all means please let me know here. Thanks!



  • Finally got everything downloaded and installed, no difference.

    Looking to download Android Studio to see if it helps.



  • @xhunterko

    Did you try taking the android studio SDK_ROOT line out of the config and set the r11c path like above ^ ?



  • Yes.

    I've done some further looking and this is what the output log is telling me:

    -dex:
    [dex] input: C:\Users\Robert\Desktop\Hello\export\android\bin\bin\classes
    [dex] input: C:\Users\Robert\Desktop\Hello\export\android\bin\deps\extension-api\bin\classes.jar
    [dex] Pre-Dexing C:\Users\Robert\Desktop\Hello\export\android\bin\deps\extension-api\bin\classes.jar -> classes-ab0b78eba175fb823fe74e51faf006b9.jar
    [dx] java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
    [dx] at java.lang.ClassLoader.defineClass1(Native Method)
    [dx] at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    [dx] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    [dx] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    [dx] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    [dx] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    [dx] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    [dx] at java.security.AccessController.doPrivileged(Native Method)
    [dx] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    [dx] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    [dx] at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
    [dx] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    [dx] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    [dx] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
    [dx] Exception in thread "main"

    BUILD FAILED
    C:\Development\Android SDK\tools\ant\build.xml:888: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:890: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:902: The following error occurred while executing this line:
    C:\Development\Android SDK\tools\ant\build.xml:283: null returned: 1

    I am curious. What could I do to avoid using the version stated? Is that the root of the problem?


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.