Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-76956

Java: can't use native c++ functions immediately

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.11.3
    • Extras: Android
    • None
    • Android

      I'm trying to call my C++ function from Java. The problem is that this is causing app crash at the very beginning of lifetime of a process. I.e. this native functions are registered with a delay.

      It seems I already created the bug some time ago but could not find it. This is still not fixed.

      I have to write workarounds every time i need to use my c++ function.

      Crash stack trace from my post on SO :

      08-22 11:10:02.087  7630  7630 E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for void org.freedownloadmanager.fdm.MyJavaNatives.onNewDownload(java.lang.String) (tried Java_org_freedownloadmanager_fdm_MyJavaNatives_onNewDownload and Java_org_freedownloadmanager_fdm_MyJavaNatives_onNewDownload__Ljava_lang_String_2)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at org.freedownloadmanager.fdm.MyJavaNatives.onNewDownload(Native Method)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at org.freedownloadmanager.fdm.MyActivity.processIntent(MyActivity.java:35)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at org.freedownloadmanager.fdm.MyActivity.onCreate(MyActivity.java:20)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:7009)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:7000)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.app.ActivityThread.-wrap11(Unknown Source:0)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:106)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.os.Looper.loop(Looper.java:164)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:6494)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
      08-22 11:10:02.087  7630  7630 E AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
      08-22 11:10:02.110  1684  2764 W ActivityManager:   Force finishing activity org.freedownloadmanager.fdm/.MyActivity

      If I call native function seconds ago from start of my process - all works as expected. So, the problem is that my Java code runs BEFORE native functions are registered.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            alervd Alexander Dyagilev
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes