How to integrate `bind` in Anroid and iOS toolchains?

At the moment to write native extension for Android and iOS is not so simple. Well, maybe for Android is more simple than iOS which required to write on Obejctive-C .

I found one library bind ( https://github.com/jeremyfa/bind ) which allows to make separate running projects in Android studio or XCode ( including suport of Swift ) and create the glue code for Haxe calls.

At example for Android creates cpp files ( https://github.com/jeremyfa/bind/tree/master/sample/android/src/android/linc ) and java files ( https://github.com/jeremyfa/bind/tree/master/sample/android/src/java )

I tried to create extension ( with lime create extension TestExtension) and replace the default source with the source from the bind library, but got the following error
Source path "C:/Users/larryb/projects/TestExtension/ndll/Android/libtestextension-v7.so" does not exist and indeed ndll/Android not have any .so files.

Here is the project https://drive.google.com/file/d/1E4xOzHJJPkj4GMuE9Y77OkJOQLYanmZm/view?usp=sharing

I think support for Swift and separate projects will be good way to write extensions in OpenFL.

Does the use of “bind” require the compilation of a separate library?

Perhaps you could try commenting/removing the <ndll ... /> tag from your test extension “include.xml” file

If you do need to compile your own C++/Objective-C then you’ll want to set up “Build.xml” and run lime rebuild path/to/extension ios

“bind” creates haxe, java and cpp glue classes . After that they should be move in the haxe project and from them using haxe build.hxml should be compile to cpp source files ( via hxcpp ) ( this is only for haxe and java classes ) . T
The remaining cpp glue classes ( from the first compilation ) should be include in the Android toolchain when compile to Android.
In fact , I have some success and compile to apk using “bind” , but get null pointer exception in execution and is hard to debug .so files with short error JNI exception.

I just wondering is it possible to write iOS extensions for OpenFL using Swift language ?

Write Swift code and use at example xcodebuild -project project.ios/IosSample.xcodeproj -target IosSampleSwift -configuration Release -sdk iphoneos to build.

Lime did incredible work for compilation to Android ( and iOS) with all configuration settings , flags and etc. I saw some other haxe libraries such as ceramic ( maybe kha and hashlink in future) to implement toolchains too .

I have not tried Swift but I assume it is possible

(bind library author here)

Swift can be interfaced to haxe through Objective-C compatible headers. When you create a Swift framework on Xcode, it can be used from Objective-C because the framework has that Objective-C compatible header bundled. That’s what is demonstrated in the sample project in the repository. I believe it is also possible to interface it via C, but I did not explore that route.

In my own setup with ceramic engine, I use bind to generate all intermediate files. Objective-C++/C++ side is automatically linked statically via hxcpp metas (that should work with OpenFL/Lime as well). Then the bound Objective-C file is added to the Xcode project itself. I use CocoaPods to make the integration of either Swift or Objective-C files easier, regardless of these coming from external libraries or local files, but I believe it is possible to do the same with a lime extension.

Similar method is used to interface with java files on Android.

Anyway, the step that bind doesn’t take care of is to integrate java file or objective-c files into the final Xcode/Android Studio project.

So, if I wanted to use bind to plug iOS/Android code to lime/openfl, I would first create a lime extension, then add to the project java or objective-c files I want to use via project.xml (I believe @singmajesty can confirm we can do that, and with what setting). Then I would run bind command to generate intermediate code and haxe interfaces for these objective-c and java files. Then, as soon as these haxe interfaces are used in the extension haxe code, and the correct objective-c/java files added to their respective projects. It should work. There is no need to compile JNI/Objective-C++ code separately as this is linked together with the haxe code with HXCPP meta (in the linc fashion).

About bind integration with Android I did that :

  1. Create OpenFL project
  2. Get the sample project ( https://github.com/jeremyfa/bind/tree/master/sample/android ) and compile it separate using bind-java.bat
  3. Copy generated bind classes linc/ and java/ folders in my project ( linc/ under android/ folder)
  4. Run project via openfl test android command

Here is the project.xml and directory scturcture:

Everything compiles fine and apk file was created , but it didn’t works. So it’s possible something with the sample was wrong , but in the Main.hx I just have simple call, nothing else :

   var nativeAndroid = AppAndroidInterface.sharedInterface();
   trace('Android versionString: ' + nativeAndroid.androidVersionString());
   trace('Android versionNumber: ' + nativeAndroid.androidVersionNumber());

The error is:

libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 30120 (SDLThread), pid 30095 (SDLActivity)
DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
DEBUG   : Build fingerprint: 'Nokia/TA-1024_00WW/ND1:9/PKQ1.181105.001/00WW_6_19B:user/release-keys'
DEBUG   : Revision: '0'
DEBUG   : ABI: 'arm64'
DEBUG   : pid: 30095, tid: 30120, name: SDLThread  >>> com.andr.testandroid <<<
DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
DEBUG   : Cause: null pointer dereference
DEBUG   :     x0  0000000000000000  x1  0000000000000000  x2  0000000000000000  x3  0000007985060a58
DEBUG   :     x4  0000007983b15fc0  x5  0000007983b16000  x6  0000007985060a58  x7  0000007985060a58
DEBUG   :     x8  0000000000000000  x9  0000007985060a78  x10 0000007985060a78  x11 0000000000000000
DEBUG   :     x12 0000000000000001  x13 000000000000000c  x14 0000007983b163a0  x15 0000007985051940
DEBUG   :     x16 000000798502f898  x17 0000007a1e7f60b0  x18 0000000000e0341c  x19 000000799d87f720
DEBUG   :     x20 0000000000000001  x21 0000007983b16598  x22 0000007983b164a0  x23 0000000000000000
DEBUG   :     x24 0000007983b165a0  x25 c2acb84c2b8b383b  x26 0000007995176a50  x27 0000000000000003
DEBUG   :     x28 0000007983b165a0  x29 0000007983b15fb0
DEBUG   :     sp  0000007983b15f90  lr  000000798473d93c  pc  000000798473d9ac
DEBUG   :
DEBUG   : backtrace:
DEBUG   :     #00 pc 000000000097b9ac  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so
DEBUG   :     #01 pc 000000000097b938  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so
DEBUG   :     #02 pc 000000000097bd40  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so
DEBUG   :     #03 pc 00000000006494a8  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so
DEBUG   :     #04 pc 0000000000649330  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so
DEBUG   :     #05 pc 00000000002d8ad8  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so
DEBUG   :     #06 pc 0000000000649088  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so
DEBUG   :     #07 pc 000000000030d680  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so
DEBUG   :     #08 pc 0000000000d62764  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/libApplicationMain.so (hxcpp_main+88)
DEBUG   :     #09 pc 000000000048f77c  /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/lib/arm64/liblime.so (Java_org_libsdl_app_SDLActivity_nativeRunMain+484)
DEBUG   :     #10 pc 00000000005661e0  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
DEBUG   :     #11 pc 000000000055d44c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
DEBUG   :     #12 pc 00000000000cf760  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
DEBUG   :     #13 pc 00000000002823b0  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
DEBUG   :     #14 pc 000000000027c36c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
DEBUG   :     #15 pc 000000000052d98c  /system/lib64/libart.so (MterpInvokeStatic+204)
DEBUG   :     #16 pc 000000000054f994  /system/lib64/libart.so (ExecuteMterpImpl+14612)
DEBUG   :     #17 pc 000000000000c814  /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.andr.testandroid-puAVKjRzIxMgLc6iFD4R9w==/base.apk (deleted) (org.libsdl.app.SDLMain.run+112)
DEBUG   :     #18 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2415914650+496)
DEBUG   :     #19 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
DEBUG   :     #20 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
DEBUG   :     #21 pc 000000000052d400  /system/lib64/libart.so (MterpInvokeInterface+1392)
DEBUG   :     #22 pc 000000000054fa14  /system/lib64/libart.so (ExecuteMterpImpl+14740)
DEBUG   :     #23 pc 00000000000ca876  /system/framework/boot-core-oj.vdex (java.lang.Thread.run+12)
DEBUG   :     #24 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2415914650+496)
DEBUG   :     #25 pc 000000000051cbc8  /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
DEBUG   :     #26 pc 00000000005662fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
DEBUG   :     #27 pc 000000000055d188  /system/lib64/libart.so (art_quick_invoke_stub+584)
DEBUG   :     #28 pc 00000000000cf740  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
DEBUG   :     #29 pc 0000000000463460  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
DEBUG   :     #30 pc 0000000000464528  /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
DEBUG   :     #31 pc 000000000048f898  /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
DEBUG   :     #32 pc 00000000000963b4  /system/lib64/libc.so (__pthread_start(void*)+36)
DEBUG   :     #33 pc 0000000000023afc  /system/lib64/libc.so (__start_thread+68)

It won’t work if you don’t do the required setup on Android side.

You need to initialize bind.Support so that it can let native thread (SDLThread) communicate with android thread (Main looper thread).
Basically you need to add code to the correct hook in your extension to do this: https://github.com/ceramic-engine/ceramic/blob/master/plugins/android/tpl/project/android/app/src/main/java/mycompany/myapp/AppActivity.java#L35-L38

Then on haxe side in your extension, you need to run this at every frame of the app:

bind.java.Support.flushRunnables();

I did the changes :

  1. Added in GameActivity.java the following code ( OpenFL also extend SDLActivity which have method loadLibraries) and add Support.java in java/bind/
  @Override
  public void loadLibraries() {

      super.loadLibraries();

      // Initialize bind
      bind.Support.setUseNativeRunnableStack(true);
      bind.Support.setContext(this);
      bind.Support.init();

  } //loadLibraries
  1. In haxe code for Lib.current.stage.addEventListener( Event.ENTER_FRAME, this._onUpdate );
    call bind.java.Support.flushRunnables(); on every frame

but still got the errors ( the new one with Fatal signal 6 (SIGABRT) )

Maybe it’s not possible to use bind with openfl .

For info here is the full log.

libc    : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 13399 (SDLThread), pid 13376 (SDLActivity)
DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
DEBUG   : Build fingerprint: 'Nokia/TA-1024_00WW/ND1:9/PKQ1.181105.001/00WW_6_19B:user/release-keys'
DEBUG   : Revision: '0'
DEBUG   : ABI: 'arm64'
DEBUG   : pid: 13376, tid: 13399, name: SDLThread  >>> com.andr.testandroid <<<
DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
DEBUG   : Abort message too long: claimed length = 531
DEBUG   :     x0  0000000000000000  x1  0000000000003457  x2  0000000000000006  x3  0000000000000008
DEBUG   :     x4  0000007a1e8b14d8  x5  0000007a1e8b14d8  x6  0000007a1e8b14d8  x7  00000000000006ad
DEBUG   :     x8  0000000000000083  x9  0000007a1e8aa230  x10 fffffff87ffffbdf  x11 5ea8d4676e421c82
DEBUG   :     x12 5ea8d4676e421c82  x13 fffffff87ffffbdf  x14 0000000000000001  x15 0000001000000000
DEBUG   :     x16 0000007a1e8e72b8  x17 0000007a1e809078  x18 0000000000000024  x19 0000000000003440
DEBUG   :     x20 0000000000003457  x21 0000000000000083  x22 0000007991fea800  x23 00000079839ec000
DEBUG   :     x24 0000000000000014  x25 0000000000000012  x26 0000000000000005  x27 000000799cf931f3
DEBUG   :     x28 000000799cf930a7  x29 0000007983bd06a0
DEBUG   :     sp  0000007983bd0660  lr  0000007a1e7fa150  pc  0000007a1e7fa17c
DEBUG   :
DEBUG   : backtrace:
DEBUG   :     #00 pc 000000000002217c  /system/lib64/libc.so (abort+124)
DEBUG   :     #01 pc 000000000046ada8  /system/lib64/libart.so (art::Runtime::Abort(char const*)+1208)
DEBUG   :     #02 pc 0000000000008dec  /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+724)
DEBUG   :     #03 pc 00000000002e8858  /system/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1656)
DEBUG   :     #04 pc 00000000002e89cc  /system/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+108)
DEBUG   :     #05 pc 00000000000fd5f8  /system/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+144)
DEBUG   :     #06 pc 00000000000fbfa8  /system/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::(anonymous namespace)::JniValueType)+1144)
DEBUG   :     #07 pc 00000000000fb31c  /system/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::(anonymous namespace)::JniValueType*)+628)
DEBUG   :     #08 pc 00000000000ff4c8  /system/lib64/libart.so (art::(anonymous namespace)::CheckJNI::GetMethodIDInternal(char const*, _JNIEnv*, _jclass*, char const*, char const*, bool)+688)
DEBUG   :     #09 pc 000000000097dba8  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #10 pc 000000000097db08  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #11 pc 00000000007d6988  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #12 pc 00000000007d6710  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #13 pc 00000000002d9400  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #14 pc 00000000007d5a90  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #15 pc 000000000030dfb8  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #16 pc 0000000000d648a4  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so (hxcpp_main+88)
DEBUG   :     #17 pc 000000000048f77c  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/liblime.so (Java_org_libsdl_app_SDLActivity_nativeRunMain+484)
DEBUG   :     #18 pc 00000000005661e0  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
DEBUG   :     #19 pc 000000000055d44c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
DEBUG   :     #20 pc 00000000000cf760  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
DEBUG   :     #21 pc 00000000002823b0  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
DEBUG   :     #22 pc 000000000027c36c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
DEBUG   :     #23 pc 000000000052d98c  /system/lib64/libart.so (MterpInvokeStatic+204)
DEBUG   :     #24 pc 000000000054f994  /system/lib64/libart.so (ExecuteMterpImpl+14612)
DEBUG   :     #25 pc 000000000000d6f4  /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/base.apk (deleted) (org.libsdl.app.SDLMain.run+156)
DEBUG   :     #26 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2415914650+496)
DEBUG   :     #27 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
DEBUG   :     #28 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
DEBUG   :     #29 pc 000000000052d400  /system/lib64/libart.so (MterpInvokeInterface+1392)
DEBUG   :     #30 pc 000000000054fa14  /system/lib64/libart.so (ExecuteMterpImpl+14740)
DEBUG   :     #31 pc 00000000000ca876  /system/framework/boot-core-oj.vdex (java.lang.Thread.run+12)
DEBUG   :     #32 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2415914650+496)
DEBUG   :     #33 pc 000000000051cbc8  /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
DEBUG   :     #34 pc 00000000005662fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
DEBUG   :     #35 pc 000000000055d188  /system/lib64/libart.so (art_quick_invoke_stub+584)
DEBUG   :     #36 pc 00000000000cf740  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
DEBUG   :     #37 pc 0000000000463460  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
DEBUG   :     #38 pc 0000000000464528  /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
DEBUG   :     #39 pc 000000000048f898  /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
DEBUG   :     #40 pc 00000000000963b4  /system/lib64/libc.so (__pthread_start(void*)+36)
DEBUG   :     #41 pc 0000000000023afc  /system/lib64/libc.so (__start_thread+68)libc    : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 13399 (SDLThread), pid 13376 (SDLActivity)
DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
DEBUG   : Build fingerprint: 'Nokia/TA-1024_00WW/ND1:9/PKQ1.181105.001/00WW_6_19B:user/release-keys'
DEBUG   : Revision: '0'
DEBUG   : ABI: 'arm64'
DEBUG   : pid: 13376, tid: 13399, name: SDLThread  >>> com.andr.testandroid <<<
DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
DEBUG   : Abort message too long: claimed length = 531
DEBUG   :     x0  0000000000000000  x1  0000000000003457  x2  0000000000000006  x3  0000000000000008
DEBUG   :     x4  0000007a1e8b14d8  x5  0000007a1e8b14d8  x6  0000007a1e8b14d8  x7  00000000000006ad
DEBUG   :     x8  0000000000000083  x9  0000007a1e8aa230  x10 fffffff87ffffbdf  x11 5ea8d4676e421c82
DEBUG   :     x12 5ea8d4676e421c82  x13 fffffff87ffffbdf  x14 0000000000000001  x15 0000001000000000
DEBUG   :     x16 0000007a1e8e72b8  x17 0000007a1e809078  x18 0000000000000024  x19 0000000000003440
DEBUG   :     x20 0000000000003457  x21 0000000000000083  x22 0000007991fea800  x23 00000079839ec000
DEBUG   :     x24 0000000000000014  x25 0000000000000012  x26 0000000000000005  x27 000000799cf931f3
DEBUG   :     x28 000000799cf930a7  x29 0000007983bd06a0
DEBUG   :     sp  0000007983bd0660  lr  0000007a1e7fa150  pc  0000007a1e7fa17c
DEBUG   :
DEBUG   : backtrace:
DEBUG   :     #00 pc 000000000002217c  /system/lib64/libc.so (abort+124)
DEBUG   :     #01 pc 000000000046ada8  /system/lib64/libart.so (art::Runtime::Abort(char const*)+1208)
DEBUG   :     #02 pc 0000000000008dec  /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+724)
DEBUG   :     #03 pc 00000000002e8858  /system/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1656)
DEBUG   :     #04 pc 00000000002e89cc  /system/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+108)
DEBUG   :     #05 pc 00000000000fd5f8  /system/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+144)
DEBUG   :     #06 pc 00000000000fbfa8  /system/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::(anonymous namespace)::JniValueType)+1144)
DEBUG   :     #07 pc 00000000000fb31c  /system/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::(anonymous namespace)::JniValueType*)+628)
DEBUG   :     #08 pc 00000000000ff4c8  /system/lib64/libart.so (art::(anonymous namespace)::CheckJNI::GetMethodIDInternal(char const*, _JNIEnv*, _jclass*, char const*, char const*, bool)+688)
DEBUG   :     #09 pc 000000000097dba8  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #10 pc 000000000097db08  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #11 pc 00000000007d6988  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #12 pc 00000000007d6710  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #13 pc 00000000002d9400  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #14 pc 00000000007d5a90  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #15 pc 000000000030dfb8  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so
DEBUG   :     #16 pc 0000000000d648a4  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/libApplicationMain.so (hxcpp_main+88)
DEBUG   :     #17 pc 000000000048f77c  /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/lib/arm64/liblime.so (Java_org_libsdl_app_SDLActivity_nativeRunMain+484)
DEBUG   :     #18 pc 00000000005661e0  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
DEBUG   :     #19 pc 000000000055d44c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
DEBUG   :     #20 pc 00000000000cf760  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
DEBUG   :     #21 pc 00000000002823b0  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
DEBUG   :     #22 pc 000000000027c36c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
DEBUG   :     #23 pc 000000000052d98c  /system/lib64/libart.so (MterpInvokeStatic+204)
DEBUG   :     #24 pc 000000000054f994  /system/lib64/libart.so (ExecuteMterpImpl+14612)
DEBUG   :     #25 pc 000000000000d6f4  /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.andr.testandroid-XV36V-0GyUTay2TCJ8lzJQ==/base.apk (deleted) (org.libsdl.app.SDLMain.run+156)
DEBUG   :     #26 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2415914650+496)
DEBUG   :     #27 pc 000000000025b9e8  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
DEBUG   :     #28 pc 000000000027c350  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
DEBUG   :     #29 pc 000000000052d400  /system/lib64/libart.so (MterpInvokeInterface+1392)
DEBUG   :     #30 pc 000000000054fa14  /system/lib64/libart.so (ExecuteMterpImpl+14740)
DEBUG   :     #31 pc 00000000000ca876  /system/framework/boot-core-oj.vdex (java.lang.Thread.run+12)
DEBUG   :     #32 pc 0000000000255e68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2415914650+496)
DEBUG   :     #33 pc 000000000051cbc8  /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
DEBUG   :     #34 pc 00000000005662fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
DEBUG   :     #35 pc 000000000055d188  /system/lib64/libart.so (art_quick_invoke_stub+584)
DEBUG   :     #36 pc 00000000000cf740  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
DEBUG   :     #37 pc 0000000000463460  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
DEBUG   :     #38 pc 0000000000464528  /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
DEBUG   :     #39 pc 000000000048f898  /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
DEBUG   :     #40 pc 00000000000963b4  /system/lib64/libc.so (__pthread_start(void*)+36)
DEBUG   :     #41 pc 0000000000023afc  /system/lib64/libc.so (__start_thread+68)

It is certainly possible to use bind with OpenFL, but it looks like JNI fails to find a java method thus crashes. You need to ensure these three files are added to the Android Studio Project:

  • bind/Support.java
  • AppAndroidInterface.java
  • bind_AppAndroidInterface.java

Just create a template extension with openfl create extension and see how java files are added to the extension for Android.