Error converting game to Android

mathgame

  • *
  • Posts: 46
I build a math game and i could build it with flash and html5 without any problems/

However, when I try to build it with android, it generated the attached log error.

grmata

  • Posts: 30
ERROR [AWT-EventQueue-0] stencyl.sw.util.dg.MessageDialog: Error: The target Android platform is no longer supported. - The currently selected Android target (API 16 - 4.1 (Jellybean)) is no longer supported. Update the target version to at least API 19 - 4.4 (KitKat).

Justin

  • *
  • Posts: 4310
Code: [Select]
2019-05-15 13:05:38,734 INFO  [Thread-22] stencyl.sw.util.StreamGobbler: [haxelib] arm-linux-androideabi-g++ -I/home/jetser/stencylworks/games-generated/plottingpoints/Export/android/obj/obj/android-v7/__pch/haxe -Iinclude --sysroot=/home/jetser/stencylworks/android-sdk/android-ndk-r15c/platforms/android-14/arch-arm -I/home/jetser/stencylworks/android-sdk/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/include -I/home/jetser/stencylworks/android-sdk/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -DHXCPP_ARMV7 -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=331 -I/home/jetser/Desktop/Stencyl-64-full/plaf/haxe/lib/hxcpp/hxcpp/include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -Wno-overflow "-D_LINUX_STDDEF_H " -Wno-psabi -DHXCPP_CPP11 -DHXCPP_ARMV7 -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 -std=c++11 ./src/scripts/SceneEvents_11.cpp -o/home/jetser/stencylworks/games-generated/plottingpoints/Export/android/obj/obj/android-v7/1939acb4_SceneEvents_11.obj
2019-05-15 13:05:38,734 INFO  [Thread-22] stencyl.sw.util.StreamGobbler: [haxelib] ./src/scripts/SceneEvents_11.cpp: In member function 'virtual void scripts::SceneEvents_11_obj::init()':
2019-05-15 13:05:38,734 INFO  [Thread-22] stencyl.sw.util.StreamGobbler: [haxelib] ./src/scripts/SceneEvents_11.cpp:2426:15: error: '::__js__' has not been declared
2019-05-15 13:05:38,735 INFO  [Thread-22] stencyl.sw.util.StreamGobbler: [haxelib]  HXLINE(  86)  ::__js__(HX_("var keys = {};\nwindow.addEventListener(\"keydown\",\n    function(e){\n        keys[e.keyCode] = true;\n        switch(e.keyCode){\n            case 37: case 39: case 38:  case 40: // Arrow keys\n            case 32: e.preventDefault(); break; // Space\n            default: break; // do not block other keys\n        }\n    },\nfalse);\nwindow.addEventListener(\"keyup\",\n    function(e){\n        keys[e.keyCode] = false;\n    },\nfalse);",5c,c1,19,fd));
2019-05-15 13:05:38,735 INFO  [Thread-22] stencyl.sw.util.StreamGobbler: [haxelib]                ^

The error here is due to some custom code you're using that's only designed for the HTML5 target.

Code: [Select]
untyped __js__('var keys = {};
window.addEventListener("keydown",
    function(e){
        keys[e.keyCode] = true;
        switch(e.keyCode){
            case 37: case 39: case 38:  case 40: // Arrow keys
            case 32: e.preventDefault(); break; // Space
            default: break; // do not block other keys
        }
    },
false);
window.addEventListener("keyup",
    function(e){
        keys[e.keyCode] = false;
    },
false);');

That code should be wrapped in the "do on HTML5" block to prevent it from being compiled on other platforms.

http://www.stencyl.com/blocks/view/flow-advanced#do-on-platform

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 8am and midnight Japan time. (GMT+9)