Please select Into the mobile phone version | Continue to access the computer ver.
App crashing when trying to integrate SDK with Android Studio
150 3 2020-12-27
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_3mSNWOK0UGfT
lvl.1
Flight distance : 2223356 ft
Germany
Offline

Can someone please help me? I followed the instructions at:    https://developer.dji.com//mobile-sdk/documentation/application-development-workflow/workflow-integrate.html#android-studio-project-integration    , only modifying the build.gradle (:app) and entering my API-key in the manifest. But when running the app it crashes with the following message:

2020-12-27 14:33:02.654 15496-15562/com.example.importsdkdemo E/AndroidRuntime: FATAL EXCEPTION: DJIExecutor Urgent #1
    Process: com.example.importsdkdemo, PID: 15496
    java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ProcessLifecycleOwner;
        at dji.sdk.sdkmanager.DJISDKManager.initParams(Unknown Source:191)
        at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:23)
        at dji.sdk.sdkmanager.DJISDKManager.registerApp(Unknown Source:42)
        at dji.sdk.sdkmanager.DJISDKManager.access$600(Unknown Source:0)
        at dji.sdk.sdkmanager.DJISDKManager$5$1.onDownloadSuccess(Unknown Source:6)
        at dji.internal.flysafe.DJIFlySafeDBLoader.a(Unknown Source:19)
        at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:33)
        at dji.sdksharedlib.util.DJISDKCacheThreadManager$1.run(Unknown Source:5)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ProcessLifecycleOwner" on path: DexPathList[[zip file "/data/user/0/com.example.importsdkdemo/.cache_sdk/sdkclasses2.jar", zip file "/data/user/0/com.example.importsdkdemo/.cache_sdk/sdkclasses.jar", zip file "/system/framework/com.android.future.usb.accessory.jar", zip file "/data/app/com.example.importsdkdemo-pZziyyWI8x3rFciBnYQ2Pg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.importsdkdemo-pZziyyWI8x3rFciBnYQ2Pg==/lib/arm64, /data/app/com.example.importsdkdemo-pZziyyWI8x3rFciBnYQ2Pg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at dji.sdk.sdkmanager.DJISDKManager.initParams(Unknown Source:191)
        at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:23)
        at dji.sdk.sdkmanager.DJISDKManager.registerApp(Unknown Source:42)
        at dji.sdk.sdkmanager.DJISDKManager.access$600(Unknown Source:0)
        at dji.sdk.sdkmanager.DJISDKManager$5$1.onDownloadSuccess(Unknown Source:6)
        at dji.internal.flysafe.DJIFlySafeDBLoader.a(Unknown Source:19)
        at dji.sdk.sdkmanager.DJISDKManager$5.run(Unknown Source:33)
        at dji.sdksharedlib.util.DJISDKCacheThreadManager$1.run(Unknown Source:5)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)






My build.gradle (:app):

apply plugin: 'com.android.application'

android {
compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
applicationId "com.example.importsdkdemo"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
buildTypes {
release {
minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
packagingOptions {
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"
        exclude 'META-INF/rxjava.properties'
    }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'



    compile ('com.dji:dji-sdk:4.12')
    provided ('com.dji:dji-sdk-provided:4.12')
}
2020-12-27
Use props
kv886
Second Officer

South Africa
Offline

Some documents are out of date. In general, I download the latest sample code to learn.
2020-12-30
Use props
Lennart Venus
lvl.1
Flight distance : 2223356 ft
Germany
Offline

kv886 Posted at 12-30 22:46
Some documents are out of date. In general, I download the latest sample code to learn.

Do you mean the code on GitHub?
2020-12-30
Use props
kv886
Second Officer

South Africa
Offline

Lennart Venus Posted at 12-30 23:08
Do you mean the code on GitHub?

Yes. The code on GitHub
2020-12-31
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules