Open Adatrader opened 2 years ago
First of all, Your MSDK can upgrade to 4.16.1. I don't find anything wrong in your build.gradle file. How about your AndroidManifest.xml file? Have you add android:extractNativeLibs="true"?
I do have extractNativeLibs="true"
but am unable to use 4.16.1 due to unrelated bug causing camera gimbal to rotate 90 degrees to left. AndroidManifest.xml below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.drone_app">
<!-- Permissions and features -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature
android:name="android.hardware.usb.host"
android:required="false" />
<uses-feature
android:name="android.hardware.usb.accessory"
android:required="true" />
<application
android:name=".application.DroneApplication"
android:allowBackup="true"
android:extractNativeLibs="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.DroneApp"
android:usesCleartextTraffic="true">
<uses-library
android:name="org.apache.http.legacy"
android:required="false" /> <!-- DJI SDK -->
<uses-library android:name="com.android.future.usb.accessory" />
<meta-data
android:name="com.dji.sdk.API_KEY"
android:value="xxx" />
<activity
android:name="dji.sdk.sdkmanager.DJIAoaControllerActivity"
android:theme="@android:style/Theme.Translucent" >
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>
<service
android:name="dji.sdk.sdkmanager.DJIGlobalService"
tools:ignore="Instantiatable" />
<!-- DJI SDK -->
<activity
android:name=".activities.ConnectionActivity"
android:configChanges="orientation"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>
<activity
android:name=".activities.MainActivity"
android:screenOrientation="landscape" />
<activity
android:name=".activities.MediaActivity"
android:screenOrientation="landscape" />
</application>
From debugging, error gets triggered with this method and specifically the setVirtualStickModeEnabled
call inside the Application class:
public static void releaseVirtualStickMode() {
Aircraft aircraft = getAircraftInstance();
if (aircraft == null)
return;
aircraft.getFlightController().setVirtualStickModeEnabled(false, (djiError) -> {});
}
I think this bug was introduced in 4.16.1 version, we will fix this in 4.16.2.
Ok, thank you for looking into this issue. Do you have an idea when 4.16.2 will be released?
2 weeks later.
Same issue
java.lang.NoClassDefFoundError: Failed resolution of: Ldji/common/util/CommonCallbacks$CompletionCallback;
aircraft.flightController.getSerialNumber(object: CommonCallbacks.CompletionCallbackWith<String> {
override fun onSuccess(serial: String) {
promise.resolve(serial)
}
override fun onFailure(error: DJIError?) {
promise.reject(error.toString(), error?.description)
}
})
android {
defaultConfig {
multiDexEnabled true
}
}
The fix, resolved some issue but now I have it when I try to call .getName() on an aircraft
I am getting this error on Android 12 devices with DJI SDK 4.16. I can link proguard, manifest, etc if that would help. Any ideas?
App gradle: