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

Java native functions registered with a delay

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.11.1
    • Fix Version/s: None
    • Component/s: Other
    • Labels:
      None
    • Platform/s:
      Android

      Description

      I have the following code for my activity:

       

      class MyJavaNatives
      {
          public static native void onNewDownload(String url);
      }
      
      
      public class MyActivity extends QtActivity
      {
          @Override
          public void onCreate(Bundle savedInstanceState)
          {
              super.onCreate(savedInstanceState);
              this.processIntent(getIntent());
          }
      
      
          @Override
          protected void onNewIntent(Intent intent)
          {
              this.processIntent(intent);
          }
      
      
          protected void processIntent(Intent intent)
          {
              if (intent != null)
              {
                  Uri data = intent.getData();
                  if (data != null)
                      MyJavaNatives.onNewDownload(data.toString());
              }
          }
      }
      

       

      If my app is running already - works fine. I.e. MyJavaNatives.onNewDownload is defined and called ok from onNewIntent method. But if I start my app with some intent, it crashes. Logcat says:

      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
      

      I've tried both methods of registering my c++ function (described here: https://www.kdab.com/qt-android-episode-5/).

      Is it Qt bug or Android NDK bug? I use the suggested r10e version of NDK.

        Attachments

          Issue Links

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

            Activity

              People

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

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes