xamarin/urho

Using SDLBinding and Forms Binding of urhoSharp

Closed this issue · 1 comments

Hi,
this is not an issue, i just think this is the right place to search help. I am trying to develope a cross-platform application with Xamarin.Forms, which is based on some large c++ code parts. Coming from pure android, i already had my java org.libsdl.app.SDLActivity connected via JNI through c++. My other java code was connected to c++ via JNI as well. For rendering i also integrated urho3d, which is the base for urhoSharp.

As i migrated to Xamarin.Forms i wanted to keep my c++ code base as it is so i searched a way to integrate SDL into Xamarin.Forms. I saw that urhoSharp had bindings for this purpose and was able to extract the necessary part from your project. Now i use the same SDL like urhoSharp, the problem i have is related to JNI, after loading my prebuilt shared render module (.so file) my application crashes, here is the stacktrace:

05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: JNI CallIntMethod called with pending exception java.lang.NoSuchMethodError: no non-static method "Lmd514be5c3217e63009fed6cc2c2de38dd4/MainActivity;.messageboxShowMessageBox(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I"
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   at int org.libsdl.app.SDLActivity.nativeInit(java.lang.Object, java.lang.String) (SDLActivity.java:-2)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   at void org.libsdl.app.SDLMain.run() (SDLActivity.java:953)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   at void java.lang.Thread.run() (Thread.java:761)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470] 
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]     in call to CallIntMethod
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]     from int org.libsdl.app.SDLActivity.nativeInit(java.lang.Object, java.lang.String)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470] "SDLThread" prio=5 tid=18 Runnable
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   | group="main" sCount=0 dsCount=0 obj=0x12e3e430 self=0x7f68504a00
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   | sysTid=12474 nice=0 cgrp=default sched=0/0 handle=0x7f677a4450
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   | state=R schedstat=( 18728589 1188857 136 ) utm=1 stm=0 core=2 HZ=100
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   | stack=0x7f676a2000-0x7f676a4000 stackSize=1037KB
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   | held mutexes= "mutator lock"(shared held)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #00 pc 0000000000475fe0  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+220)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #01 pc 0000000000475fdc  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+216)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #02 pc 000000000044a828  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+472)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #03 pc 00000000002ebdcc  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1128)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #04 pc 00000000002ec4b4  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+120)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #05 pc 0000000000101780  /system/lib64/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+156)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #06 pc 0000000000101190  /system/lib64/libart.so (_ZN3art11ScopedCheck11CheckThreadEP7_JNIEnv+544)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #07 pc 00000000000fecc8  /system/lib64/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+1120)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #08 pc 00000000001045dc  /system/lib64/libart.so (_ZN3art8CheckJNI13CheckCallArgsERNS_18ScopedObjectAccessERNS_11ScopedCheckEP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDNS_10InvokeTypeEPKNS_7VarArgsE+140)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #09 pc 000000000010389c  /system/lib64/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+704)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #10 pc 00000000000f5f50  /system/lib64/libart.so (_ZN3art8CheckJNI13CallIntMethodEP7_JNIEnvP8_jobjectP10_jmethodIDz+160)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #11 pc 00000000005c4570  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (Android_JNI_ShowMessageBox+752)
05-09 14:32:34.683 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #12 pc 00000000005ca9cc  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (SDL_ShowMessageBox+224)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #13 pc 00000000005caab0  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (SDL_ShowSimpleMessageBox+136)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #14 pc 0000000000915f80  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (_ZN6Urho3D11Application9ErrorExitERKNS_6StringE+932)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #15 pc 00000000009164a8  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (_ZN6Urho3D11Application3RunEv+160)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #16 pc 00000000004e6b60  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (_Z14RunApplicationv+72)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #17 pc 00000000005c1334  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (Java_org_libsdl_app_SDLActivity_nativeInit+324)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   native: #18 pc 00000000000a3674  /data/app/com.companyname.Xamarin-1/oat/arm64/base.odex (Java_org_libsdl_app_SDLActivity_nativeInit__Ljava_lang_Object_2Ljava_lang_String_2+176)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   at org.libsdl.app.SDLActivity.nativeInit(Native method)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   at org.libsdl.app.SDLMain.run(SDLActivity.java:953)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470]   at java.lang.Thread.run(Thread.java:761)
05-09 14:32:34.684 F/art     (12444): art/runtime/java_vm_ext.cc:470] 
05-09 14:32:34.730 F/art     (12444): art/runtime/runtime.cc:403] Runtime aborting...
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403] Aborting thread:
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403] "SDLThread" prio=5 tid=18 Native
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   | group="" sCount=0 dsCount=0 obj=0x12e3e430 self=0x7f68504a00
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   | sysTid=12474 nice=0 cgrp=default sched=0/0 handle=0x7f677a4450
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   | state=R schedstat=( 34698746 1587867 143 ) utm=3 stm=0 core=2 HZ=100
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   | stack=0x7f676a2000-0x7f676a4000 stackSize=1037KB
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   | held mutexes= "abort lock"
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #00 pc 0000000000475fe0  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+220)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #01 pc 0000000000475fdc  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+216)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #02 pc 000000000044a828  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+472)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #03 pc 0000000000438a0c  /system/lib64/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+56)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #04 pc 0000000000438888  /system/lib64/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+668)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #05 pc 000000000042c4fc  /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+140)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #06 pc 00000000000e4b24  /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+1204)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #07 pc 00000000002ec1e0  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+2172)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #08 pc 00000000002ec4b4  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+120)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #09 pc 0000000000101780  /system/lib64/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+156)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #10 pc 0000000000101190  /system/lib64/libart.so (_ZN3art11ScopedCheck11CheckThreadEP7_JNIEnv+544)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #11 pc 00000000000fecc8  /system/lib64/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+1120)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #12 pc 00000000001045dc  /system/lib64/libart.so (_ZN3art8CheckJNI13CheckCallArgsERNS_18ScopedObjectAccessERNS_11ScopedCheckEP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDNS_10InvokeTypeEPKNS_7VarArgsE+140)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #13 pc 000000000010389c  /system/lib64/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+704)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #14 pc 00000000000f5f50  /system/lib64/libart.so (_ZN3art8CheckJNI13CallIntMethodEP7_JNIEnvP8_jobjectP10_jmethodIDz+160)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #15 pc 00000000005c4570  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (Android_JNI_ShowMessageBox+752)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #16 pc 00000000005ca9cc  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (SDL_ShowMessageBox+224)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #17 pc 00000000005caab0  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (SDL_ShowSimpleMessageBox+136)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #18 pc 0000000000915f80  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (_ZN6Urho3D11Application9ErrorExitERKNS_6StringE+932)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #19 pc 00000000009164a8  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (_ZN6Urho3D11Application3RunEv+160)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #20 pc 00000000004e6b60  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (_Z14RunApplicationv+72)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #21 pc 00000000005c1334  /data/app/com.companyname.Xamarin-1/lib/arm64/libVRRender.so (Java_org_libsdl_app_SDLActivity_nativeInit+324)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   native: #22 pc 00000000000a3674  /data/app/com.companyname.Xamarin-1/oat/arm64/base.odex (???)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   at org.libsdl.app.SDLActivity.nativeInit(Native method)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   at org.libsdl.app.SDLMain.run(SDLActivity.java:953)
05-09 14:32:34.731 F/art     (12444): art/runtime/runtime.cc:403]   at java.lang.Thread.run(Thread.java:761)

I know this is not directly related to urhoSharp, but maybe you had similiar issues while developing it. Anyway thank in advance for time and attention.

Please use forums.xamarin.com to ask questions like this, as you will likely reach a larger audience.