8

I have a problem trying to emulate the ImportSDKDemo project.

I am following this tutorial, but there is a missing information, e.g. about MainActivity.class.

When I try to run the emulation I get the following error:

java.lang.UnsatisfiedLinkError: No implementation found for byte[] dji.midware.natives.SDKRelativeJNI.native_getXXXX(java.lang.String) (tried Java_dji_midware_natives_SDKRelativeJNI_native_1getXXXX and Java_dji_midware_natives_SDKRelativeJNI_native_1getXXXX__Ljava_lang_String_2)

Here is the whole log:

09-14 05:04:29.389 3080-3080/? I/m.importsdkdem: Not late-enabling -Xcheck:jni (already on)
09-14 05:04:29.499 3080-3080/? W/m.importsdkdem: Unexpected CPU variant for X86 using defaults: x86
09-14 05:04:30.082 3080-3080/dji.com.importsdkdemo E/sdk: install begin
09-14 05:04:30.086 3080-3080/dji.com.importsdkdemo V/sdk: DexInstall beging
    installSecondarDexs
09-14 05:04:30.086 3080-3080/dji.com.importsdkdemo W/m.importsdkdem: Accessing hidden field Ldalvik/system/BaseDexClassLoader;->pathList:Ldalvik/system/DexPathList; (light greylist, reflection)
    Accessing hidden method Ldalvik/system/DexPathList;->makeInMemoryDexElements([Ljava/nio/ByteBuffer;Ljava/util/List;)[Ldalvik/system/DexPathList$Element; (light greylist, JNI)
09-14 05:04:30.320 3080-3080/dji.com.importsdkdemo W/m.importsdkdem: Accessing hidden field Ldalvik/system/DexPathList;->dexElements:[Ldalvik/system/DexPathList$Element; (light greylist, reflection)
09-14 05:04:30.320 3080-3080/dji.com.importsdkdemo V/sdk: DexInstall end
09-14 05:04:30.376 3080-3098/dji.com.importsdkdemo I/m.importsdkdem: Background concurrent copying GC freed 3588(1814KB) AllocSpace objects, 0(0B) LOS objects, 42% free, 8MB/14MB, paused 12.441ms total 165.671ms
09-14 05:04:30.549 3080-3080/dji.com.importsdkdemo W/m.importsdkdem: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
    Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
09-14 05:04:30.594 3080-3142/dji.com.importsdkdemo E/linker: "/data/app/dji.com.importsdkdemo-jCjys7hOmf0GKv6jezsaUw==/lib/x86/libffmpeg.so" has text relocations (https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-Enforced-for-API-level-23)
09-14 05:04:30.614 3080-3142/dji.com.importsdkdemo W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/dji.com.importsdkdemo-jCjys7hOmf0GKv6jezsaUw==/lib/x86/libffmpeg.so" has text relocations (https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-Enforced-for-API-level-23)
        at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
        at java.lang.System.loadLibrary(System.java:1669)
        at dji.midware.natives.SDKRelativeJNI.<clinit>(Unknown Source:2)
        at dji.midware.natives.SDKRelativeJNI.native_getXXXX(Native Method)
        at com.dji.g.a.a.b.a(Unknown Source:24)
        at com.dji.g.a.a.b.a(Unknown Source:5)
        at dji.sdk.sdkmanager.DJISDKManager.<clinit>(Unknown Source:2)
        at dji.sdk.sdkmanager.DJISDKManager.getInstance(Unknown Source:0)
        at dji.com.importsdkdemo.MainActivity$1.run(MainActivity.java:121)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
09-14 05:04:30.615 3080-3142/dji.com.importsdkdemo W/System.err:     at java.lang.Thread.run(Thread.java:764)
09-14 05:04:30.615 3080-3142/dji.com.importsdkdemo D/SDKRelativeJNI: Couldn't load lib
09-14 05:04:30.615 3080-3142/dji.com.importsdkdemo E/m.importsdkdem: No implementation found for byte[] dji.midware.natives.SDKRelativeJNI.native_getXXXX(java.lang.String) (tried Java_dji_midware_natives_SDKRelativeJNI_native_1getXXXX and Java_dji_midware_natives_SDKRelativeJNI_native_1getXXXX__Ljava_lang_String_2)
09-14 05:04:30.625 3080-3142/dji.com.importsdkdemo E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: dji.com.importsdkdemo, PID: 3080
    java.lang.UnsatisfiedLinkError: No implementation found for byte[] dji.midware.natives.SDKRelativeJNI.native_getXXXX(java.lang.String) (tried Java_dji_midware_natives_SDKRelativeJNI_native_1getXXXX and Java_dji_midware_natives_SDKRelativeJNI_native_1getXXXX__Ljava_lang_String_2)
        at dji.midware.natives.SDKRelativeJNI.native_getXXXX(Native Method)
        at com.dji.g.a.a.b.a(Unknown Source:24)
        at com.dji.g.a.a.b.a(Unknown Source:5)
        at dji.sdk.sdkmanager.DJISDKManager.<clinit>(Unknown Source:2)
        at dji.sdk.sdkmanager.DJISDKManager.getInstance(Unknown Source:0)
        at dji.com.importsdkdemo.MainActivity$1.run(MainActivity.java:121)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
09-14 05:04:30.655 3080-3080/dji.com.importsdkdemo D/OpenGLRenderer: Skia GL Pipeline
09-14 05:04:30.656 3080-3142/dji.com.importsdkdemo I/Process: Sending signal. PID: 3080 SIG: 9

How can I resolve this problem?

Feel free to ask for the code or the screenshots :)

ADinhLux
  • 121
  • 1
  • 7
  • You should share some code to make that question answerable – Nico Haase Sep 14 '18 at 12:59
  • Well, I 've just followed the DJI tutorial ( Integrate SDK into Application ) and at the end, when I run the emulation, I got this error code in the logcat ( see the pastebin link ). I can't paste all the lines because my question will be too long :s – ADinhLux Sep 14 '18 at 13:05
  • 1
    Thank you @scopchanov for editing my question :). I'm still a novice in Stackoverflow text editor. – ADinhLux Sep 14 '18 at 13:17
  • I think it is more clear now. Feel free to correct some inaccuracies if I have misunderstood something. Good luck with finding help! – scopchanov Sep 14 '18 at 13:18

1 Answers1

7

So it looks like you're using the 4.7.1 SDK and probably targeting a modern Android SDK. The issue you're experiencing is that DJI decided to bundle a version of libffmpeg.so that is incompatible with modern SDK versions on the x86 platform (the x86 platform is what your emulator is running on).

You have 2, possibly three options:

  1. In Android Studio, when you create a new Virtual Device, when you get to Select a system image go to the Other images tab. From there select any of the 'arm' images and use that. The emulator will be extremely slow with this option, and might not run at all if your computer is old or slow.
  2. Connect a real Android device to your computer with debugging mode enabled and run the demo on that.
  3. In your build.gradle file, set compileSdkVersion and targetSdkVersion to 23 which is the latest version in which DJI's provided libffmpeg.so file will load. This is the worst option though, as Google doesn't allow anybody to publish apps with SDK versions this low anymore. The version must be 26 or above now: https://support.google.com/googleplay/android-developer/answer/113469#targetsdk
Dan O.
  • 111
  • 5
  • 1
    So either a slow emulator, the need for a real device or using an old (not recommended) version of Android to target? There has a be a better fix than this from DJI? – user754730 Oct 09 '18 at 10:46
  • 2
    I'm just a 3rd party dev like you, but the answer is that you're correct. Until DJI decides to bundle a properly built version of libffmpgeg.so in an SDK update, we're stuck with these options. The real pain is our apps wont work in any real x86 device either (though there aren't very many of those to begin with) – Dan O. Oct 10 '18 at 13:33
  • According to support at DJI, the version should be set at 22 and not 23. This does not work for the latest SDK version 4.9 which apparently requires the version to be at minimum 24. I am going to try 4.4.1 since most of the current documentation still wrongly refers to that configuration anyways. https://stackoverflow.com/questions/52010511/issue-with-running-dji-ux-sdk-4-7 – SChalice Mar 02 '19 at 03:24
  • Version 4.4.1 works on x86 even with the target version set at 24. Someone on another thread suggested version 4.6 would work as well. https://github.com/dji-sdk/Mobile-UXSDK-Android/releases – SChalice Mar 02 '19 at 03:59