Closed JurajBegovac closed 3 years ago
Agent comment from Luce Luo in Zendesk ticket #49087:
Dear Customer,
Thank you for contacting DJI. We will record this problem and you can use the recommended setting for the being time. https://github.com/dji-sdk/Mobile-SDK-Android/blob/master/Sample%20Code/app/build.gradle
Thanks,
Luce Luo
DJI Developer Support
°°°
Hmmm well not sure if recommended settings fit other code but I'll try to use it
Yeah well in that case I cannot use latest appCompat, materialDesign, navigation etc etc :/
I had to downgrade to these versions:
const val appCompat = "1.2.0"
const val lifecycle = "2.2.0"
const val navigation = "2.3.5"
const val hilt = "2.32-alpha"
const val hiltAndroidX = "1.0.0-alpha03"
This is not so nice :/
I am currently experiencing the same issue. I would like to be able to use the latest Jetpack Compose and Navigation features, however this issue is blocking that transition. A fix or workaround would be great.
DJISDKManager.getInstance().registerApp() is not running on main thread,currently does not support the latest lifecycle.
4.15 will fix it.
@Michael-DJI Ok and when could we expect that version? :)
I am using version 4.15 now, but this mentioned issue still occurs. Are you sure it is fixed @Michael-DJI? Is anyone else still experiencing this issue?
@Qubiz is the same crash stack info?
@Michael-DJI Yes, it is the same crash stack-trace as in the original post.
https://github.com/dji-sdk/Mobile-SDK-Android/blob/master/Sample%20Code/app/build.gradle the sample has update lifecycle to 2.3.1,It works well。 Can you reproduce on the sample code? @Qubiz
@Hoker- Thanks for the reply. I have now tried version 2.3.1 for the dependencies in my project:
implementation("androidx.lifecycle:lifecycle-extensions") {
version {
strictly("2.0.0-rc01")
}
}
implementation("androidx.lifecycle:lifecycle-common-java8") {
version {
strictly("2.3.1")
}
}
implementation("androidx.lifecycle:lifecycle-runtime-ktx") {
version {
strictly("2.3.1")
}
}
implementation("androidx.lifecycle:lifecycle-process") {
version {
strictly("2.3.1")
}
}
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx") {
version {
strictly("2.3.1")
}
}
However, this still produces the same error for me:
java.lang.IllegalStateException: Method addObserver must be called on the main thread
at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:317)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:172)
at dji.sdk.sdkmanager.DJISDKManager.initParams(Unknown Source:192)
at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:12)
at dji.sdk.sdkmanager.DJISDKManager.registerApp(Unknown Source:42)
at dji.sdk.sdkmanager.DJISDKManager.access$800(Unknown Source:0)
at dji.sdk.sdkmanager.DJISDKManager$6$1.onDownloadSuccess(Unknown Source:8)
at dji.internal.ghu.ghu.fdd(Unknown Source:19)
at dji.sdk.sdkmanager.DJISDKManager$6.run(Unknown Source:37)
at dji.sdksharedlib.gfd.koy.run(Unknown Source:5)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
I am not sure what I am doing wrong to be honest.
I will try the sample code next, to see if I can reproduce it there.
@Qubiz thank you, we will wait for your latest testing result on the sample code.
@Michael-DJI I tested the sample code and I can't reproduce the error when using the initial gradle configuration.
However, I did manage to reproduce the error when adding the UXSDK as a replacement for the MSDK like this:
implementation('com.dji:dji-uxsdk:4.14', {
exclude module: 'library-anti-distortion'
exclude module: 'fly-safe-database'
})
compileOnly 'com.dji:dji-sdk-provided:4.15'
I suspect that the UXSDK v4.14 still uses the MSDK v4.14?
The error does not occur anymore when I explicitly add the com.dji:dji-sdk:4.15'
dependency as well:
implementation('com.dji:dji-uxsdk:4.14', {
exclude module: 'library-anti-distortion'
exclude module: 'fly-safe-database'
})
implementation('com.dji:dji-sdk:4.15', {
exclude module: 'library-anti-distortion'
exclude module: 'fly-safe-database'
})
compileOnly 'com.dji:dji-sdk-provided:4.15'
@Michael-DJI I tested the sample code and I can't reproduce the error when using the initial gradle configuration.
However, I did manage to reproduce the error when adding the UXSDK as a replacement for the MSDK like this:
implementation('com.dji:dji-uxsdk:4.14', { exclude module: 'library-anti-distortion' exclude module: 'fly-safe-database' }) compileOnly 'com.dji:dji-sdk-provided:4.15'
I suspect that the UXSDK v4.14 still uses the MSDK v4.14?
The error does not occur anymore when I explicitly add the
com.dji:dji-sdk:4.15'
dependency as well:implementation('com.dji:dji-uxsdk:4.14', { exclude module: 'library-anti-distortion' exclude module: 'fly-safe-database' }) implementation('com.dji:dji-sdk:4.15', { exclude module: 'library-anti-distortion' exclude module: 'fly-safe-database' }) compileOnly 'com.dji:dji-sdk-provided:4.15'
https://mvnrepository.com/artifact/com.dji/dji-uxsdk/4.14 yes,uxsdk v4.14 still uses MSDK v4.14,you need to replace manually。
Crash stacktrace:
From lifecycle version 2.3.0 (which was released in February this year) there is a change:
Source: https://developer.android.com/jetpack/androidx/releases/lifecycle#version_230_3
Please fix it asap :)