dji-sdk / Mobile-SDK-Android

DJI Mobile SDK for Android: http://developer.dji.com/mobile-sdk/
Other
980 stars 579 forks source link

Multidex Initialization error and DJI SDK 4.13.1 resource build problem #694

Open LGstudio-dev opened 3 years ago

LGstudio-dev commented 3 years ago

I keep having issues running my application, as I get a very long error on initializing multiDex.

JNI DETECTED ERROR IN APPLICATION: buf == null
 in call to SetPrimitiveArrayRegion
 from java.lang.Object[] com.secneo.sdk.Helper.makeInMemoryDexElements(java.lang.Object, java.util.List, java.lang.String)
"main" prio=5 tid=1 Runnable
  | group="main" sCount=0 dsCount=0 flags=0 obj=0x75a82f58 self=0x7c43215c00
  | sysTid=14813 nice=-10 cgrp=default sched=0/0 handle=0x7cc99f3548
  | state=R schedstat=( 888172402 20226557 185 ) utm=82 stm=6 core=5 HZ=100
  | stack=0x7fc9427000-0x7fc9429000 stackSize=8MB
  | held mutexes= "mutator lock"(shared held) 

hundreds of native: #xxx pc 00000000000bc630  /system/.... errors come

 at com.secneo.sdk.Helper.makeInMemoryDexElements(Native method)
 at com.secneo.sdk.DexInstall.V26install(DexInstall.java:139)
 at com.secneo.sdk.DexInstall.installSecondaryDexes(DexInstall.java:71)
 at com.secneo.sdk.DexInstall.install(DexInstall.java:40)
 at com.secneo.sdk.Helper.install(Helper.java:43)
 at <my package name>.MainApplication.attachBaseContext(MainApplication.java:69)
 at android.app.Application.attach(Application.java:224)
 at android.app.Instrumentation.newApplication(Instrumentation.java:1128)
 at android.app.LoadedApk.makeApplication(LoadedApk.java:1175)
 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6688)
 at android.app.ActivityThread.access$2000(ActivityThread.java:273)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2020)
 at android.os.Handler.dispatchMessage(Handler.java:112)
 at android.os.Looper.loop(Looper.java:216)
 at android.app.ActivityThread.main(ActivityThread.java:7625)
 at java.lang.reflect.Method.invoke(Native method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

...... AND So on .. the error is long

I had no problems running my app a few month back, but now it just does not start.

in my Appilcation I have:

@Override
    protected void attachBaseContext(Context paramContext) {
        super.attachBaseContext(paramContext);
        MultiDex.install(this);   <--------- IT CRASHES HERE
        Helper.install(this);
    }

and I have the following dependencies:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation ('com.dji:dji-sdk:4.11', {
        exclude module: 'fly-safe-database'
    })
    implementation 'com.google.android.gms:play-services-vision:20.1.2'
    implementation 'com.squareup:otto:1.3.8'
    implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
    implementation 'com.dji:dji-uxsdk:4.11'
    compileOnly 'com.dji:dji-sdk-provided:4.11'
    testImplementation 'junit:junit:4.13'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

I know there is already the SDK 4.13.1, but past 4.11 I am unable to build my app, due to some strange resource error:

C:\Users\user\.gradle\caches\transforms-2\files-2.1\95a77c43e0aea3d55206c60144b8f9d3\jetified-dji-sdk-4.13.1\res\layout\dji_dialog_login.xml:12: AAPT: error: attribute layout_constraintEnd_toEndOf (aka <my package name>:layout_constraintEnd_toEndOf) not found.

C:\Users\user\.gradle\caches\transforms-2\files-2.1\95a77c43e0aea3d55206c60144b8f9d3\jetified-dji-sdk-4.13.1\res\layout\dji_dialog_login.xml:12: AAPT: error: attribute layout_constraintTop_toTopOf (aka <my package name>:layout_constraintTop_toTopOf) not found.

Any help would be much appreciated.

dji-dev commented 3 years ago

Agent comment from Luce Luo in Zendesk ticket #41705:

Dear Customer,

Thank you for contacting DJI. The 4.11 version is so old and has so many unstable issues as it happened to you. So, please try to consider to update to the latest 4.13.1 version.

For the 4.13.1, please refer to our official sample to build it. https://github.com/dji-sdk/Mobile-SDK-Android

Thanks,

Luce Luo DJI Developer Support

LGstudio-dev commented 3 years ago

After long hours of searching, I have managed to make the 4.13.1 running.

ryaa commented 3 years ago

I'm having very similar build error for the app with SDK version 4.14-trial1

/Users/alexryltsov/.gradle/caches/transforms-2/files-2.1/a02cf2844184aeacb2d95caed4509480/jetified-dji-sdk-4.14-trial1/res/layout/dji_dialog_login.xml:12: AAPT: error: attribute layout_constraintEnd_toEndOf (aka com.mobile.boss811:layout_constraintEnd_toEndOf) not found.

UPDATE: adding the below to dependencies in build.gradle seems to fixed the above error

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'