Closed DanielZelei closed 1 year ago
Hey @DanielZelei Can you please share your .gradle files from the /android platform folder? (Just mask any sensitive properties there).
P.S. Did you follow the instructions here? https://github.com/DragonX-cloud/dji_flutter_plugin#configuring-the-dji-sdk-on-your-flutter-android-kotlin-project
@orenagiv this issue comes in android 13 , i am also getting class not found exception, although same apk works fine below android 13
Hey @zohaib1313 Thanks for your input!
I'll check and let you know.
FYI @DanielZelei
Hey @zohaib1313 @DanielZelei
I've pushed a branch called feature/android-13
.
Please pull it and follow these steps:
dart pub get
to update all the Flutter dependencies.Note When you're on Android Studio and trying to compile - If you get errors about a "namespace" missing in the build.gradles files of the dependencies, then you will need to manually edit the build.grade file of the relevant package and add the "namespace" based on the same package-id from the AndroidManifest.xml file of that package.
For example, the package path_provider
build.gradle file should have the namespace
like so:
android {
namespace "io.flutter.plugins.pathprovider"
compileSdk 31
...
And it was taken from the path_provider_android
package > manifests > AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.flutter.plugins.pathprovider">
</manifest>
And I also had to edit the AndroidManifest.xml and remove the "package" attribute, so the result is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
I had to do this manually in my Android project, to every dependency that is used by the Example project:
All these packages can be found by going into the .pub-cache folder:
cd ~/.pub-cache/hostes/pub.dev/
Please note I have only tested that the Example app compiles on Android 13 and launches properly, and that the "Register" function works (and the status becomes "registered"). I have not yet tested all the functionalities of the package and the Example app.
Let me know how it goes and if you managed to get it to run properly.
Hey @zohaib1313 @DanielZelei
I've published an update to the package (v1.0.12) which resolves the Android 13 issues without the need to upgrade Gradle and the packages as described in my previous message.
Update your pubspec.yaml
with v1.0.12
to fetch the latest update:
dependencies:
dji: ^1.0.12
Bottom line - the required changes are to update the list of permissions in the AndroidManifest.xml
and to change the targetSdkVersion
in the build.gradle
file to 31.
Give it a shot and let me know how it goes :)
Hey @zohaib1313 Per my comment here:
https://github.com/dji-sdk/Mobile-SDK-Android/issues/1242#issuecomment-1700539618
Let's continue the progress here, as it seems it can be resolved at the DJI Flutter plugin level itself.
@zohaib1313
Please note there's a branch called feature/android-13
with upgraded packages, including the upgraded Pigeon plugin.
In the DjiPlugin.kt - there is the onAttachedToAcitivity
which triggers the Multidex and the Helper.install:
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
this.djiPluginActivity = binding.activity
// [ ! ] DJI SDK Must be "installed" using this function, before any method of DJI SDK is used.
MultiDex.install(this.djiPluginContext)
Helper.install(this.djiPluginActivity.application)
}
I've validated that it gets triggered when the Example application launches.
So I'm not yet sure why with targetSdk 33
it doesn't work, and we get the class-not-found exception (with but targetSdk 31
it does work).
Please describe where exactly did you add the Helper.install in your project - and I'd like to do the same on the Example application and see if it works.
Hey @zohaib1313 Did you get a chance to read my last message above?
Hey @zohaib1313 I'm closing this issue for now. If you can share your insights per my comment above, that would be great.
Hello @orenagiv,
First of all, thank you for this project !
I tried to build & run the example project from Android Studio to my Android device (Samsung Galaxy S20). The app is running, but when I try to press "Register" I get the following error (basically I always get this error if I press any button in the example app):
What I did: First I created a new app under my DJI developer account with the package name cloud.dragonx.plugin.flutter.djiExample and then I copied the API key to android:value under com.dji.sdk.API_KEY.
I tried multiple way to test:
With the official DJI Fly app it is working well, but now I removed it for having only 1 app which would control my drone.
Other notes:
Could you please help me here ?
Thank you in advance for any help !