Skip to content

NoClassDefFoundError while Running the Sample Code #289

@ikanor

Description

@ikanor

Hi there! I'm trying to run the sample project android-sdk-v5-as, and after a successful compilation, the app is exiting with an error:

 Caused by: java.lang.ClassNotFoundException: Didn't find class "dji.v5.manager.SDKManager"

I am not very experienced in Android development but to my understanding the package is missing the dependencies. It indeed fails at the first reference of the SDK classes. I also tried debugging and evaluating any other expression using SDK classes (i.e.: DJISDKInitEvent.INITIALIZE_COMPLETE) also fails with the same error.

I tried with the recommended version of Android Studio 2021.2.1.16, but also with 2022.3.1.18 and 2023.2.1.23, with the same result. I'm developing in Ubuntu Linux and an x86_64 architecture (uname returns Linux 6.5.0-15-generic #15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux), which by the way forced me to enable said architecture in the build.gradle file:

diff --git a/SampleCode-V5/android-sdk-v5-sample/build.gradle b/SampleCode-V5/android-sdk-v5-sample/build.gradle
index 737d179..64f0e1b 100644
--- a/SampleCode-V5/android-sdk-v5-sample/build.gradle
+++ b/SampleCode-V5/android-sdk-v5-sample/build.gradle
@@ -16,7 +16,7 @@ android {
         manifestPlaceholders["AMAP_API_KEY"] = project.AMAP_API_KEY
         manifestPlaceholders["GMAP_API_KEY"] = project.GMAP_API_KEY
         ndk {
-            abiFilters 'arm64-v8a'
+            abiFilters 'arm64-v8a', 'x86_64'
         }
     }

I am using the latest code from main, and dependencies point to the 5.8.0 version of the SDK:

    deps.aircraft = "com.dji:dji-sdk-v5-aircraft:5.8.0"
    deps.aircraftProvided = "com.dji:dji-sdk-v5-aircraft-provided:5.8.0"
    deps.networkImp = "com.dji:dji-sdk-v5-networkImp:5.8.0"

I do have the target Android SDK version 33 downloaded and I'm using a Pixel 3a API 33 x86_64 virtual device to install and run the app. I might be missing something obvious here but I am all out of ideas, so any hints would be much appreciated. Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions