I'm using dynamic feature module.I have mentioned few service classes in DFM.But when the app is published to play store for few users I'm getting this exception only for one service class that happens only in the background(Crashlytics stats)

minSdk - 21 devices - Oppo(Android 12),Lenovo(Android 10),Samsung(Android 11)

Fatal Exception: java.lang.RuntimeException: Unable to create NotificationService: java.lang.ClassNotFoundException: Didn't find class on path: DexPathList
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:4668)
       at android.app.ActivityThread.access$100(ActivityThread.java:254)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2203)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:344)
       at android.app.ActivityThread.main(ActivityThread.java:8212)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

Caused by java.lang.ClassNotFoundException: Didn't find class NotificationService on path: DexPathList
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
       at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:129)
       at androidx.core.app.CoreComponentFactory.instantiateService(CoreComponentFactory.java:75)
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:4637)
       at android.app.ActivityThread.access$100(ActivityThread.java:254)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2203)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:344)
       at android.app.ActivityThread.main(ActivityThread.java:8212)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)


Manifest File

<service
    android:name=".NotificationService"
    android:exported="true"
    android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
    <intent-filter>
        <action android:name="android.service.notification.NotificationListenerService" />
    </intent-filter>
</service>

build.gradle

plugins {
    id 'com.android.dynamic-feature'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'kotlin-platform-android'
    id 'kotlin-parcelize'
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
}
android {
    compileSdk 31

    defaultConfig {
        minSdk 21
    }

    buildFeatures {
        viewBinding = true
        dataBinding = true
    }
    buildTypes {
        debug {
            debuggable true
        }
        release {
            debuggable false
            minifyEnabled false
        }
    }
    flavorDimensions "default"
    productFlavors {
        dev {
            dimension = 'default'
        }
        prod {
            dimension = 'default'
        }
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/CHANGES'
        exclude 'META-INF/README.md'
        exclude 'META-INF/*'
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }
    configurations.all {
        resolutionStrategy {
            exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
            exclude group: "com.squareup.okio"
            exclude group: "com.squareup.picasso"
        }
    }
    defaultConfig {
        testInstrumentationRunnerArguments clearPackageData: 'true'
        vectorDrawables.useSupportLibrary = true
    }
    testOptions {
        unitTests.returnDefaultValues = true
    }
    sourceSets {
        main {
            aidl {
                srcDirs 'src/main/aidl'
            }
        }
    }
}

Analysed apk and found this mentioned class,Changed with absolute path in manifest, it doesn't throw any exception in debug or production build(shared in app sharing and internal testing) happens only after being published

0

There are 0 answers