Search code examples
androiddji-sdk

Intergrate DJI UXSDK to My Android Studio3.5 failed


I am tring to intergrate DJI UXSDK to my Android project on Android Studio3.5,and I am following its official doc ,fortunately, "Sync with Gradle File" successed,however,when I tried to build and install my project,it failed,And I tried to using Gradle File in DJIUXSDKDemo,failed again,I still can't build my project,does anyone can help me? thanks a lot.


Solution

  • I have solved this question by changing my gradle file, the guide in official doc is following:

    apply plugin: 'com.android.application'
    
    android {
    
        ...
        defaultConfig {
            ...
        }
    
        ...
    
        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 {
       ...
        compile ('com.dji:dji-sdk:4.11.2')
        provided ('com.dji:dji-sdk-provided:4.11.2')
    }
    

    Unfortunately, it is not complete,so we should change to this:

    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"
    
            pickFirst 'lib/*/libstlport_shared.so'
            pickFirst 'lib/*/libRoadLineRebuildAPI.so'
            pickFirst 'lib/*/libGNaviUtils.so'
            pickFirst 'lib/*/libGNaviMapex.so'
            pickFirst 'lib/*/libGNaviData.so'
            pickFirst 'lib/*/libGNaviMap.so'
            pickFirst 'lib/*/libGNaviSearch.so'
            pickFirst 'assets/location_map_gps_locked.png'
            pickFirst 'assets/location_map_gps_3d.png'
    
            exclude '/lib/armeabi-v7a/libChineseFontPkg.so'
            exclude 'META-INF/rxjava.properties'
        }
    
        compileOptions {
            sourceCompatibility 1.8
            targetCompatibility 1.8
        }
    

    and add following into your dependencies:

     implementation 'com.dji:dji-uxsdk:4.12'
        compileOnly 'com.dji:dji-sdk-provided:4.12'