Android Development



  • @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?



  • Victory pose:

    0_1502790157142_DHQtJ4TWsAA4ZgF.jpg

    For anyone ELSE with this error. You need to install the latest jdk build as the others are depreciated. ALSO. You need to add the following to your Project.xml file:

    <window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />
    <android target-sdk-version="24"/>
    <window hardware="true" allow-shaders="true" require-shaders="true" if="cpp"/>
    <window vsync="true" antialiasing="4" if="cpp" />
    <window orientation="portrait" /> || <window orientation="landscape" if="cpp"/>

    IF you are building FlappyBalt you need to comment out this line:

    <!--template path="libs/AndroidManifest.xml" rename="AndroidManifest.xml" if="android"/-->

    FlappyBalt ALSO requires the ADB to be installed and running to work.

    ALSO. During research I found that android does not like folders with commas in them. So when I tried to run the examples in the flixeldemos folder 2,2,2 it failed to run with errors. Moved them to the desktop, made those changes to their Project.xml files, and they built and ran on my phone! FINALLY.

    NOW I got new problems which I'm going to research too. For instance, after I successfully ran mode, I am unable to run my other games now. They now build but at the end they give the error:

    Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

    Starting: Intent { act=android.intent.action.MAIN cmp=com.example.myapp/.MainActivity }

    And mode launches instead of any game I tell it to run.

    Anyone know why this is?

    Hope this helps somebody. Whether or not the sdk NEEDS to be 24, I tried 17 (from http://haxeflixel.com/documentation/android/ by the way) and that led to build errors so it may be just safe to use the latest sdk build you can. ALSO the adb so far was only needed for FlappyBalt. No other example has needed it yet.

    Thanks again for helping everyone!

    EDIT: Okay, If you get this, or app does not exist. Try: Cleaning project, rebuild. Delete exports, rebuild. Close, restart flashdevelop. Have one instance of flashdevelop with one game running. Uninstall app from phone. Disconnect phone. Reconnect phone and rebuild app. Try and work backwards. Uh, try those in various orders. But it's working again and I don't know what worked. Here's hoping I don't have to find out again.



  • @xhunterko

    yay!

    I think the Failure [INSTALL_FAILED_VERSION_DOWNGRADE] problem might be the package name in project.xml. Make sure they are 3 segments and unique.

    <meta title="Game Title" package="com.mydomain.GameTitle" version="1.0" company="" />


  • @dean said in Android Development:

    package="com.mydomain.GameTitle"

    Allrighty I'll try that for future compiles. Thanks again for your help!



  • @xhunterko

    You're welcome. Good luck with your game!


Log in to reply
 

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