Ad

Notification Not Received After "minifyEnabled True" In Android, Why?

my notification receive when build.gradel file minifyEnabled false, but whenever we change the minifyEnabled true notification not received in my signed release APK. This is my build.gradel file,

android {
    compileSdkVersion 28
defaultConfig {
    applicationId "com.abc.xyz.test"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 10
    versionName "1.0.8"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    signingConfig signingConfigs.brand_champs
}
lintOptions {
    disable 'GoogleAppIndexingWarning'
    warningsAsErrors true
    checkReleaseBuilds false
}
dexOptions {
    javaMaxHeapSize "4g"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
 'proguard-rules.pro'
        debuggable false
        jniDebuggable false
        renderscriptDebuggable false
        zipAlignEnabled false
    }
    debug {
        debuggable true
        zipAlignEnabled false
        jniDebuggable false
        minifyEnabled false
    }
 }

}
Ad

Answer

Friends solved the above issue,

this issue was related to class migrate or unused class removed from the code when proguard enable.

We write the keep rules in proguard file, and keep the my all model of the application those are related to notifcation

-keepclassmembers class com.xyz.test.model.** {
 *;
}

this is my class model "com.xyz.test.model.**", you have any different class, according to your id and package name

Ad
source: stackoverflow.com
Ad