Kode / Kinc

Modern low level game library and hardware abstraction.
http://kinc.tech
zlib License
511 stars 121 forks source link

[Android] App crash at startup with Vulkan #871

Closed Sanva closed 4 months ago

Sanva commented 5 months ago

Describe the bug The Empty test app crashes at startup in Android with «Didn't find class "tech.kinc.KincActivity" on path: DexPathList» (without changing the package name of the app).

To Reproduce Steps to reproduce the behavior:

  1. Compile Empty test app to Android using kmake android, them build with Android Studio.

Execution Environment:

LogCat message:

FATAL EXCEPTION: main
Process: tech.kinc, PID: 9817
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{tech.kinc/tech.kinc.KincActivity}: java.lang.ClassNotFoundException: Didn't find class "tech.kinc.KincActivity" on path: DexPathList[[zip file "/data/app/~~bG0DUNK4hR-DglERMlG3Vg==/tech.kinc-_9dRiev2AfQleniAxFsP0w==/base.apk"],nativeLibraryDirectories=[/data/app/~~bG0DUNK4hR-DglERMlG3Vg==/tech.kinc-_9dRiev2AfQleniAxFsP0w==/lib/x86_64, /data/app/~~bG0DUNK4hR-DglERMlG3Vg==/tech.kinc-_9dRiev2AfQleniAxFsP0w==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3689)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8177)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.ClassNotFoundException: Didn't find class "tech.kinc.KincActivity" on path: DexPathList[[zip file "/data/app/~~bG0DUNK4hR-DglERMlG3Vg==/tech.kinc-_9dRiev2AfQleniAxFsP0w==/base.apk"],nativeLibraryDirectories=[/data/app/~~bG0DUNK4hR-DglERMlG3Vg==/tech.kinc-_9dRiev2AfQleniAxFsP0w==/lib/x86_64, /data/app/~~bG0DUNK4hR-DglERMlG3Vg==/tech.kinc-_9dRiev2AfQleniAxFsP0w==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
    at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1378)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3676)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922) 
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139) 
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) 
    at android.os.Handler.dispatchMessage(Handler.java:106) 
    at android.os.Looper.loopOnce(Looper.java:205) 
    at android.os.Looper.loop(Looper.java:294) 
    at android.app.ActivityThread.main(ActivityThread.java:8177) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) 

Maybe there is something missing in my system?

RobDangerous commented 5 months ago

Hu, f7d6ef53 does not seem to be an actual Kinc revision. Also your build output is incomplete.

Sanva commented 5 months ago

Ups! Sorry, I was compiling from the wrong directory, so it looks like kmake wasn't picking the right folder for Kinc.

Now, compiling from the right directory (I've also tested from another directory but using the -k option to specify my global Kinc folder, with same results):

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1000000 in tid 10883 (Thread-5), pid 10861 (tech.kinc)
2024-04-08 00:08:02.341 10861-10861 threaded_app            tech.kinc                            V  WindowFocusChanged: 0x74c560cb7530 -- 0
2024-04-08 00:08:02.586 10893-10893 DEBUG                   crash_dump64                         A  Cmdline: tech.kinc
2024-04-08 00:08:02.586 10893-10893 DEBUG                   crash_dump64                         A  pid: 10861, tid: 10883, name: Thread-5  >>> tech.kinc <<<
2024-04-08 00:08:02.587 10893-10893 DEBUG                   crash_dump64                         A        #05 pc 000000000003dbe6  /data/app/~~je-pzleVbKIutAuyCgXUhQ==/tech.kinc-Pvv_U2V5RCUJ8XyOu8XxWA==/base.apk!libkinc.so (offset 0x1f000) (kinc_log_args+390) (BuildId: 5f58e6d19f84385ae17ea1f7d5cc2b44d573115f)
2024-04-08 00:08:02.587 10893-10893 DEBUG                   crash_dump64                         A        #06 pc 000000000003da2c  /data/app/~~je-pzleVbKIutAuyCgXUhQ==/tech.kinc-Pvv_U2V5RCUJ8XyOu8XxWA==/base.apk!libkinc.so (offset 0x1f000) (kinc_log+156) (BuildId: 5f58e6d19f84385ae17ea1f7d5cc2b44d573115f)
2024-04-08 00:08:02.587 10893-10893 DEBUG                   crash_dump64                         A        #07 pc 0000000000029bf5  /data/app/~~je-pzleVbKIutAuyCgXUhQ==/tech.kinc-Pvv_U2V5RCUJ8XyOu8XxWA==/base.apk!libkinc.so (offset 0x1f000) (kinc_g5_internal_init+2293) (BuildId: 5f58e6d19f84385ae17ea1f7d5cc2b44d573115f)
2024-04-08 00:08:02.587 10893-10893 DEBUG                   crash_dump64                         A        #08 pc 00000000000232a8  /data/app/~~je-pzleVbKIutAuyCgXUhQ==/tech.kinc-Pvv_U2V5RCUJ8XyOu8XxWA==/base.apk!libkinc.so (offset 0x1f000) (kinc_g4_internal_init+8) (BuildId: 5f58e6d19f84385ae17ea1f7d5cc2b44d573115f)
2024-04-08 00:08:02.587 10893-10893 DEBUG                   crash_dump64                         A        #09 pc 000000000003be63  /data/app/~~je-pzleVbKIutAuyCgXUhQ==/tech.kinc-Pvv_U2V5RCUJ8XyOu8XxWA==/base.apk!libkinc.so (offset 0x1f000) (kinc_init+131) (BuildId: 5f58e6d19f84385ae17ea1f7d5cc2b44d573115f)
2024-04-08 00:08:02.587 10893-10893 DEBUG                   crash_dump64                         A        #10 pc 0000000000022cb2  /data/app/~~je-pzleVbKIutAuyCgXUhQ==/tech.kinc-Pvv_U2V5RCUJ8XyOu8XxWA==/base.apk!libkinc.so (offset 0x1f000) (kickstart+66) (BuildId: 5f58e6d19f84385ae17ea1f7d5cc2b44d573115f)
2024-04-08 00:08:02.587 10893-10893 DEBUG                   crash_dump64                         A        #11 pc 000000000003a630  /data/app/~~je-pzleVbKIutAuyCgXUhQ==/tech.kinc-Pvv_U2V5RCUJ8XyOu8XxWA==/base.apk!libkinc.so (offset 0x1f000) (android_main+480) (BuildId: 5f58e6d19f84385ae17ea1f7d5cc2b44d573115f)
2024-04-08 00:08:02.587 10893-10893 DEBUG                   crash_dump64                         A        #12 pc 0000000000038c0a  /data/app/~~je-pzleVbKIutAuyCgXUhQ==/tech.kinc-Pvv_U2V5RCUJ8XyOu8XxWA==/base.apk!libkinc.so (offset 0x1f000) (BuildId: 5f58e6d19f84385ae17ea1f7d5cc2b44d573115f)

Kinc build output:

Using Kinc (03845a96, ?? Tests/Empty/.vscode/) from /home/valentin/Kinc
kfile found.
Creating Android project files.
Compiling shader 1 of 4 (shader.frag).
Compiling shader 2 of 4 (shader.vert).
Compiling shader 3 of 4 (g1.frag).
Compiling shader 4 of 4 (g1.vert).
Done.
Sanva commented 5 months ago

Looks like something related to Vulkan — if I compile with --graphics opengl the example works as expected (shows a red triangle).

RobDangerous commented 5 months ago

Well, that wasn't the same result at all, that was a completely different crash. Will have a look at the Vulkan situation.

RobDangerous commented 5 months ago

Ah, "same result" was just related to the -k option. Alright.

Sanva commented 5 months ago

It looks like an incorrect double usage of a va_list argument in kinc_log when targeting Android, I'll do some tests and a pull request with a fix.