DJI android sdk 在启动时崩溃(仅当使用 macOS 构建时)
DJI android sdk crash on start up (only if built with macOS)
如果 运行 应用程序是在 macOS 上构建的,我会遇到异常:
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)
在此异常之前我得到了这个:
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.gg.wp-D5RSHkictI89woc7FOnlUQ==/lib/arm64/libSDKRelativeJNI.so" .dynamic section has invalid offset: 0x1c350, expected to match PT_DYNAMIC offset: 0x0
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)
但如果我在 Windows 上构建相同的项目,它会正常工作。
我在真实设备 (Samsung Galaxy S10) 上 运行 应用程序,所以它不是 x86 ffmpeg 问题。
我该如何解决这个问题?
将这些行添加到 gradle.build 修复问题:
packagingOptions {
exclude 'META-INF/rxjava.properties'
doNotStrip "*/*/libdjivideo.so"
doNotStrip "*/*/libSDKRelativeJNI.so"
doNotStrip "*/*/libFlyForbid.so"
doNotStrip "*/*/libduml_vision_bokeh.so"
doNotStrip "*/*/libyuv2.so"
doNotStrip "*/*/libGroudStation.so"
doNotStrip "*/*/libFRCorkscrew.so"
doNotStrip "*/*/libUpgradeVerify.so"
doNotStrip "*/*/libFR.so"
doNotStrip "*/*/libDJIFlySafeCore.so"
doNotStrip "*/*/libdjifs_jni.so"
doNotStrip "*/*/libsfjni.so"
}
如果 运行 应用程序是在 macOS 上构建的,我会遇到异常:
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)
在此异常之前我得到了这个:
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.gg.wp-D5RSHkictI89woc7FOnlUQ==/lib/arm64/libSDKRelativeJNI.so" .dynamic section has invalid offset: 0x1c350, expected to match PT_DYNAMIC offset: 0x0
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)
但如果我在 Windows 上构建相同的项目,它会正常工作。 我在真实设备 (Samsung Galaxy S10) 上 运行 应用程序,所以它不是 x86 ffmpeg 问题。
我该如何解决这个问题?
将这些行添加到 gradle.build 修复问题:
packagingOptions {
exclude 'META-INF/rxjava.properties'
doNotStrip "*/*/libdjivideo.so"
doNotStrip "*/*/libSDKRelativeJNI.so"
doNotStrip "*/*/libFlyForbid.so"
doNotStrip "*/*/libduml_vision_bokeh.so"
doNotStrip "*/*/libyuv2.so"
doNotStrip "*/*/libGroudStation.so"
doNotStrip "*/*/libFRCorkscrew.so"
doNotStrip "*/*/libUpgradeVerify.so"
doNotStrip "*/*/libFR.so"
doNotStrip "*/*/libDJIFlySafeCore.so"
doNotStrip "*/*/libdjifs_jni.so"
doNotStrip "*/*/libsfjni.so"
}