dji-sdk / Mobile-SDK-Android

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

dji.v5.manager.SDKManager.<init>(): [0x0] Constructor returning without calling superclass constructor #1311

Open 18519230326 opened 5 months ago

18519230326 commented 5 months ago

java.lang.VerifyError: Verifier rejected class dji.v5.manager.SDKManager: void dji.v5.manager.SDKManager.() failed to verify: void dji.v5.manager.SDKManager.(): [0x0] Constructor returning without calling superclass constructor void dji.v5.manager.SDKManager.(dji.v5.manager.SDKManager$1) failed to verify: void dji.v5.manager.SDKManager.(dji.v5.manager.SDKManager$1): [0x0] Constructor returning without calling superclass constructor (declaration of 'dji.v5.manager.SDKManager' appears in /data/app/~~830Ai5T7Rim-jmM5UMla3g==/com.BeondReality.anima-ynkXfSQJUAlLprfI1CSwig==/base.apk!classes2.dex) at com.BeondReality.anima.MyApplication.onCreate(MyApplication.java:25) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1335) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7603) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2428) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:368) at android.app.ActivityThread.main(ActivityThread.java:8848) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)

18519230326 commented 5 months ago

Please tell me how to deal with this error.

dji-dev commented 5 months ago

Agent comment from yating.liao in Zendesk ticket #109951:

Could you provide us with information on how you configured the SDK? This error often occurs due to misconfigurations or incomplete SDK decryption.

°°°

huongta157 commented 2 months ago

I got the same error as the config, please help me check it

import com.android.build.api.dsl.BuildType
import java.text.SimpleDateFormat
import java.util.Date

val appName = "App Name"

plugins {
    id("com.android.application")
    kotlin("android")
    id("org.jetbrains.kotlin.plugin.serialization") version "2.0.0-Beta1"
    id("dagger.hilt.android.plugin")
    id("kotlin-parcelize")
    id("com.google.devtools.ksp")
    id("com.google.firebase.crashlytics")
    id("com.google.gms.google-services")
}

android {
    namespace = "com.xxx.yyy"
    compileSdk = 34
    buildToolsVersion = "30.0.3"

    defaultConfig {
        applicationId = "com.xxx.yyy"
        minSdk = 27
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"

        ndk {
            abiFilters += listOf("arm64-v8a")
        }
    }

    signingConfigs {
        getByName("debug") {
            storeFile = file("../keystores/debug.jks")
        }

        create("production") {
            storeFile = file("../keystores/release.jks")
            storePassword = ""
            keyAlias = ""
            keyPassword = ""
        }
    }

    buildTypes {
        release {
            isDebuggable = true
            isMinifyEnabled = true
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
            signingConfig = signingConfigs.getByName("production")

            resValue("string", "app_name", appName)
        }

        debug {
            isDebuggable = true
            isMinifyEnabled = false
            applicationIdSuffix = ".debug"
            signingConfig = signingConfigs.getByName("debug")

            resValue("string", "app_name", "[DEV]-${appName}")
        }
    }

    packagingOptions {
        pickFirst("lib/arm64-v8a/libc++_shared.so")
        pickFirst("ib/armeabi-v7a/libc++_shared.so")
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
        freeCompilerArgs += listOf("-Xjvm-default=all")
    }

    buildFeatures {
        viewBinding = true
        buildConfig = true
    }

    hilt {
        enableExperimentalClasspathAggregation = true
    }

    ksp {
        arg("room.schemaLocation", "$projectDir/schemas")
    }

    lintOptions {
        isCheckReleaseBuilds = false
        isAbortOnError = false
    }

    packagingOptions {
        doNotStrip("*/*/libconstants.so")
        doNotStrip("*/*/libdji_innertools.so")
        doNotStrip("*/*/libdjibase.so")
        doNotStrip("*/*/libDJICSDKCommon.so")
        doNotStrip("*/*/libDJIFlySafeCore-CSDK.so")
        doNotStrip("*/*/libdjifs_jni-CSDK.so")
        doNotStrip("*/*/libDJIRegister.so")
        doNotStrip("*/*/libdjisdk_jni.so")
        doNotStrip("*/*/libDJIUpgradeCore.so")
        doNotStrip("*/*/libDJIUpgradeJNI.so")
        doNotStrip("*/*/libDJIWaypointV2Core-CSDK.so")
        doNotStrip("*/*/libdjiwpv2-CSDK.so")
        doNotStrip("*/*/libFlightRecordEngine.so")
        doNotStrip("*/*/libvideo-framing.so")
        doNotStrip("*/*/libwaes.so")
        doNotStrip("*/*/libagora-rtsa-sdk.so")
        doNotStrip("*/*/libc++.so")
        doNotStrip("*/*/libc++_shared.so")
        doNotStrip("*/*/libmrtc_28181.so")
        doNotStrip("*/*/libmrtc_agora.so")
        doNotStrip("*/*/libmrtc_core.so")
        doNotStrip("*/*/libmrtc_core_jni.so")
        doNotStrip("*/*/libmrtc_data.so")
        doNotStrip("*/*/libmrtc_log.so")
        doNotStrip("*/*/libmrtc_onvif.so")
        doNotStrip("*/*/libmrtc_rtmp.so")
        doNotStrip("*/*/libmrtc_rtsp.so")
    }
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-stdlib:2.0.10")
    implementation("androidx.core:core-ktx:1.13.1")
    implementation("androidx.appcompat:appcompat:1.7.0")
    implementation("com.google.android.material:material:1.12.0")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.8.0")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
    implementation("androidx.fragment:fragment-ktx:1.8.3")
    implementation("androidx.activity:activity-ktx:1.9.2")
    // Lifecycles only (without ViewModel or LiveData)
    val lifecycleVersion = "2.8.6"
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
    implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")

    // Gson
    implementation("com.google.code.gson:gson:2.10.1")

    // Hilt
    implementation("com.google.dagger:hilt-android:2.50")
    ksp("com.google.dagger:hilt-compiler:2.50")

    // Retrofit
    implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")
    implementation("com.squareup.retrofit2:retrofit:2.11.0")
    implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")

    // Glide
    implementation("com.github.bumptech.glide:glide:4.16.0")
    annotationProcessor("com.github.bumptech.glide:compiler:4.15.1")

    // Billing
    implementation("com.android.billingclient:billing-ktx:7.1.0")

    // RoundedImageview
    implementation("com.makeramen:roundedimageview:2.3.0")

    // Circle Imageview
    implementation("de.hdodenhof:circleimageview:3.1.0")

    // Swipe refresh Layout
    implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")

    // Indicator
    implementation("me.relex:circleindicator:2.1.6")

    // Firebase
    implementation(platform("com.google.firebase:firebase-bom:33.3.0"))
    implementation("com.google.firebase:firebase-config-ktx")
    implementation("com.google.firebase:firebase-analytics-ktx")
    implementation("com.google.firebase:firebase-crashlytics-ktx")
    implementation("com.google.firebase:firebase-messaging-ktx")

    // Rating Api
    implementation("com.google.android.play:review:2.0.1")
    implementation("com.google.android.play:review-ktx:2.0.1")

    // Debug Database
    debugImplementation("com.amitshekhar.android:debug-db:1.0.6")

    // Admob
    implementation("com.google.android.gms:play-services-ads:23.3.0")
    // Consent
    implementation("com.google.android.ump:user-messaging-platform:3.0.0")

    // In-app update
    implementation("com.google.android.play:app-update:2.1.0")
    implementation("com.google.android.play:app-update-ktx:2.1.0")

    val sdkVersion = "5.11.0-a1"
    implementation("com.dji:dji-sdk-v5-aircraft-alpha:$sdkVersion")
    implementation("com.dji:dji-sdk-v5-aircraft-provided-alpha:$sdkVersion")
    implementation("com.dji:dji-sdk-v5-networkImp-alpha:$sdkVersion")
    implementation(project(":android-sdk-v5-uxsdk"))
}

// Config for output apk
android.applicationVariants.configureEach {
    outputs.all {
        val formattedDate = SimpleDateFormat("yyyy-MM-dd").format(Date())
        val buildNumber = versionCode
        (this as? com.android.build.gradle.internal.api.BaseVariantOutputImpl)?.outputFileName =
            "$appName${name}_${versionName}.${buildNumber}_${formattedDate}.apk"
    }
}

fun BuildType.addConstString(key: String, value: Any?, isManifestPlaceholders: Boolean = false) {
    val stringValue = value?.toString() ?: return
    buildConfigField("String", key, "\"${stringValue}\"")
    if (isManifestPlaceholders) {
        manifestPlaceholders[key] = stringValue
    }
}