问题描述
我正在尝试加载Android-UxsdkDemo示例项目,但出现错误“无法解决:com.dji:dji-uxsdk:4.13.1”。我正在使用Android Studio 4.0.1。 奇怪的是,我在gradle中有实现'com.dji:dji-uxsdk:4.13',所以我不为什么它抱怨“无法解决:com.dji:dji-uxsdk:4.13.1”。知道有什么问题吗?
apply plugin: 'com.android.application'
repositories {
mavenLocal()
}
android {
compileSdkVersion 29
buildToolsversion '29.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
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 true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
lintOptions {
abortOnError false
}
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"
doNotStrip "*/*/libDJICommonJNI.so"
doNotStrip "*/*/libDJICSDKCommon.so"
doNotStrip "*/*/libDJIUpgradeCore.so"
doNotStrip "*/*/libDJIUpgradeJNI.so"
doNotStrip "*/*/libDJIWaypointV2Core.so"
doNotStrip "*/*/libAMapSDK_MAP_v6_9_2.so"
doNotStrip "*/*/libDJIMOP.so"
exclude 'meta-inf/rxjava.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.squareup:otto:1.3.8'
implementation('com.dji:dji-sdk:4.13',{
/**
* 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.13'
implementation 'com.dji:dji-uxsdk:4.13'
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.1.0'
implementation filetree(include: ['*.jar'],dir: 'libs')
testImplementation 'junit:junit:4.12'
}
// Please uncomment the following code if you use your own sdk version.
apply from : "https://terra-1-g.djicdn.com/71a7d383e71a4fb8887a310eb746b47f/msdk/Android-CommonConfig/config_sample_all.gradle"
apply from : "https://terra-1-g.djicdn.com/71a7d383e71a4fb8887a310eb746b47f/msdk/Android-CommonConfig/config_sample_dependencies_uxsdk.gradle"
我的build.gradle(Module:app)是https://github.com/DJI-Mobile-SDK-Tutorials/Android-UXSDKDemo/tree/master的原始内容
解决方法
只有sdk更新到4.13.1,ui sdk保持在4.13。
它应显示为:
implementation('com.dji:dji-uxsdk:4.13',{
/**
* Comment the "library-anti-distortion" if your app does need Anti Distortion for Mavic 2 Pro and Mavic 2 Zoom.
* Comment the "fly-safe-database" if you do not 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'
/**
* Uncomment the following line to exclude amap from the app.
* Note that Google Play Store does not allow APKs that include this library.
*/
//exclude group: 'com.amap.api'
//exclude group: 'com.mapbox.mapboxsdk'
})
compileOnly('com.dji:dji-sdk-provided:4.13.1')
,
下面两行是应用 DJI 服务器的最新版本。删除这些行以解决问题。
apply from : "https://terra-1-g.djicdn.com/71a7d383e71a4fb8887a310eb746b47f/msdk/Android-CommonConfig/config_sample_all.gradle"
apply from : "https://terra-1-g.djicdn.com/71a7d383e71a4fb8887a310eb746b47f/msdk/Android-CommonConfig/config_sample_dependencies_uxsdk.gradle"