DJI-Mobile-SDK-Tutorials / Android-VideoStreamDecodingSample

This sample project demonstrates how to use FFmpeg for video frame parsing and to use MediaCodec for hardware decoding on DJI Products.
MIT License
169 stars 80 forks source link

Does not work with 4.11 #59

Closed neilyoung closed 4 years ago

neilyoung commented 4 years ago

as subject says.

Didn't find class "androidx.lifecycle.LifecycleObserver"

neilyoung commented 4 years ago

OK, let's be a bit more specific.

implementation('com.dji:dji-sdk:4.11', {
        //if your app needn't support Mavic 2 Pro and Mavic 2 Zoom, pls exclude the library-anti-distortion module
        //like following
        //exclude module: 'library-anti-distortion'

        //Uncomment the following line if your APP does not need network RTK.
        //For Phantom 4 RTK and Matrice 210 RTK V2. Network RTK can be used as a virtual reference station to provide
        //cm level accurate position.
        //exclude module: 'library-networkrtk-helper'
    })
    compileOnly 'com.dji:dji-sdk-provided:4.11'

yuvDataListener.onYuvDataReceived(null, yuvDataBuf, bufferInfo.size - bufferInfo.offset, width, height);


- Compile, install. App crashes very early in  

DJISDKManager.getInstance().registerApp(ConnectionActivity.this.getApplicationContext(), new DJISDKManager.SDKManagerCallback() { }


with 

2019-09-24 21:06:54.432 31128-31160/? I/zygote64: Rejecting re-init on previously-failed class java.lang.Class<dji.sdk.sdkmanager.DJISDKManager$DJILifecycleListener>: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/LifecycleObserver; 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at dji.sdk.sdkmanager.DJISDKManager dji.sdk.sdkmanager.DJISDKManager.getInstance() (:-1) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void com.dji.videostreamdecodingsample.ConnectionActivity$2.run() (ConnectionActivity.java:106) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void android.os.AsyncTask$SerialExecutor$1.run() (AsyncTask.java:245) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1162) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:636) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void java.lang.Thread.run() (Thread.java:764) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.LifecycleObserver" on path: DexPathList[[zip file "/data/app/com.dji.videostreamdecodingsample-ruAaKdDxqK_EK8AS5WU-AQ==/base.apk", zip file "/data/app/com.dji.videostreamdecodingsample-ruAaKdDxqK_EK8AS5WU-AQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.dji.videostreamdecodingsample-ruAaKdDxqK_EK8AS5WU-AQ==/split_lib_resources_apk.apk", zip file "/data/app/com.dji.videostreamdecodingsample-ruAaKdDxqK_EK8AS5WU-AQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.dji.videostreamdecodingsample-ruAaKdDxqK_EK8AS5WU-AQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.dji.videostreamdecodingsample-ruAaKdDxqK_EK8AS5WU-AQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.dji.videostreamdecodingsample-ruAaKdDxqK_EK8AS5WU-AQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.dji.videostreamdecodingsample-ruAaKdDxqK_EK8AS5WU-AQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.dji.videostreamdecodingsample 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at dji.sdk.sdkmanager.DJISDKManager dji.sdk.sdkmanager.DJISDKManager.getInstance() (:-1) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void com.dji.videostreamdecodingsample.ConnectionActivity$2.run() (ConnectionActivity.java:106) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void android.os.AsyncTask$SerialExecutor$1.run() (AsyncTask.java:245) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1162) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:636) 2019-09-24 21:06:54.432 31128-31160/? I/zygote64: at void java.lang.Thread.run() (Thread.java:764) 2019-09-24 21:06:54.447 31128-31160/? E/AndroidRuntime: FATAL EXCEPTION: DJIExecutor Urgent #1



No idea, how to solve this:`Didn't find class "androidx.lifecycle.LifecycleObserver`
dji-dev commented 4 years ago

Public comment from Luce Luo in Zendesk ticket #28278:

Dear Neil,

Thank you for contacting DJI. Please refer to this sample to add the androidx supported into your project. https://github.com/dji-sdk/Mobile-SDK-Android/blob/master/Sample%20Code/app/build.gradle

implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.core:core:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-rc01' implementation 'androidx.annotation:annotation:1.0.0'

Thanks,

Luce Luo DJI Dev Team

neilyoung commented 4 years ago

@dji-dev Does not compile with the original, adapted sample:

Executing tasks: [:app:assembleDebug]

:app:buildInfoDebugLoader
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:mainApkListPersistenceDebug UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources
:app:generateDebugSources
:app:javaPreCompileDebug
Note: /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/src/main/java/com/dji/videostreamdecodingsample/media/DJIVideoStreamDecoder.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugJavaWithJavac
:app:instantRunMainApkResourcesDebug
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:validateSigningDebug
:app:processInstantRunDebugResourcesApk
:app:checkManifestChangesDebug
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithDependencyCheckerForDebug UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:mergeDebugJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:processDebugJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDebug
:app:transformClassesWithInstantRunForDebug
:app:transformClassesEnhancedWithInstantReloadDexForDebug
:app:incrementalDebugTasks
:app:preColdswapDebug
:app:fastDeployDebugExtractor
:app:generateDebugInstantRunAppInfo
:app:transformClassesWithInstantRunSlicerForDebug
:app:transformClassesWithDexBuilderForDebug
AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.os.ResultReceiver$1","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
:app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/0.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/1.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/2.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/3.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/4.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/5.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/6.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/7.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/8.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/9.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/10.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/11.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/12.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/13.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/14.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/15.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/16.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/17.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/18.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/19.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/20.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/21.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/22.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/23.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/24.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/25.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/26.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/27.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/28.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/29.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/30.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/31.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/32.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/33.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/34.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/35.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/36.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/37.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/38.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/39.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/40.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/41.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/42.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/43.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/44.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/45.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/46.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/47.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/48.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/49.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/50.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/51.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/52.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/53.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/54.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/55.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/56.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/57.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/58.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/59.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/60.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/61.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/62.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/63.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/64.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/65.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/66.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/67.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/68.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/69.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/70.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/71.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/72.jar, /Users/decades/Documents/tmp/Android-VideoStreamDecodingSample/android-videostreamdecodingsample/app/build/intermediates/transforms/dexBuilder/debug/73.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s
39 actionable tasks: 27 executed, 12 up-to-date

build.gradle:


apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.dji.videostreamdecodingsample"
        minSdkVersion 19
        targetSdkVersion 28
        multiDexEnabled true
        ndk {
            // On x86 devices that run Android API 23 or above, if the application is targeted with API 23 or
            // above, FFmpeg lib might lead to runtime crashes or warnings.
            abiFilters 'armeabi-v7a', 'x86', 'arm64-v8a'
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            shrinkResources false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jni.srcDirs=[]
            jniLibs.srcDirs=['../libs']
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    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'
    }
}
dependencies {
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation('com.dji:dji-sdk:4.11', {
        /**
         * Uncomment the "library-anti-distortion" if your app does not need Anti Distortion for Mavic 2 Pro and Mavic 2 Zoom.
         * Uncomment the "fly-safe-database" if you need database for release, or we will download it when DJISDKManager.getInstance().registerApp
         * is called.
         * Both will greatly reducing the size of the APK.
         */
        exclude module: 'library-anti-distortion'
        exclude module: 'fly-safe-database'
    })
    compileOnly 'com.dji:dji-sdk-provided:4.11'
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.core:core:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-rc01'
    implementation 'androidx.annotation:annotation:1.0.0'

}
dji-dev commented 4 years ago

Public comment from Luce Luo in Zendesk ticket #28278:

Dear Neil,

Thank you for contacting DJI. Sorry, please wait for the official update for this sample.

Thanks,

Luce Luo DJI Dev Team

cwbsl commented 4 years ago

Any update on this issue? I'm facing the same problem and urgently need to resubmit the app to the play store before it get's removed because of the AMAP SDK.

Edit: Seems like this fixes the problem for us, thanks a lot!

neilyoung commented 4 years ago

@cwbsl Could you please be a bit more specific? What "this" fixes what problem? Did you comment on the wrong thread?

neilyoung commented 4 years ago

@dji-dev OK, I will let you participate.

You need to upgrade to gradle 3.2.0 or greater. Then right mouse click your project and Refactor\Migrate to Android X

This will at least produce something, which can be loaded to your device. If it runs? Tomorrow more...

cwbsl commented 4 years ago

@cwbsl Could you please be a bit more specific? What "this" fixes what problem? Did you comment on the wrong thread?

No, I'm completely in the right thread, the answer by dji-dev https://github.com/DJI-Mobile-SDK-Tutorials/Android-VideoStreamDecodingSample/issues/59#issuecomment-534923232 fixes the issue. Make sure you have implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-rc01' in your build.gradle file.

neilyoung commented 4 years ago

OK, I don't have that extension in build.gradle, but I could make it run following my receipt (one post above yours). Updating to gradle 3.2.0 (I was updating to 3.2.5) and "Refactoring to AndroidX" did it for the original sample.

Edit: Sorry, I have that extension. But it didn't make it for me. I had to migrate to AndroidX.

Anyway. For me it's solved