android - 在android中“minifyEnabled true”后未收到通知,为什么?
问题描述
我的通知在 build.gradel 文件 minifyEnabled false时收到,但每当我们更改minifyEnabled true时,我的签名版本 APK 中未收到通知。这是我的build.gradel文件,
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
}
}
}
解决方案
朋友解决了以上问题,
此问题与启用 proguard 时从代码中删除的类迁移或未使用的类有关。
我们在proguard文件中写了保留规则,并保留了与通知相关的应用程序的我的所有模型
-keepclassmembers class com.xyz.test.model.** {
*;
}
这是我的类模型“com.xyz.test.model.**”,你有任何不同的类,根据你的 id 和包名
推荐阅读
- c - 执行时间或结果时间是否正确?
- xslt - 将数字格式化为 xsl 中的两位数?
- vue.js - 在 Vuetify-js 数据表中搜索不可见字段
- azure - 使用 Azure 数据工厂将数据发布到 REST API
- plugins - Figma 访问主组件
- fluent-ui - fluent-ui中TooltipHost的背景颜色
- javascript - 当我在 Heroku 上运行我的应用程序时,我收到错误代码 h10
- python - 在熊猫中显示数据框
- php - 我正在使用 PHP 和 mysqli 构建 IP 阻止系统,但系统仅阻止第一行中的 IP
- php - LDAP 搜索具有特定管理员的所有用户