Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.11.1
-
None
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
- is duplicated by
-
QTBUG-76956 Java: can't use native c++ functions immediately
- Closed