Google 播放预启动报告崩溃
Google Play Prelaunch Report Crash
我最近发布了一个应用到 Google Play,但是我收到了这个错误 -
java.lang.NoSuchMethodError: No static method createWithResource(Landroid/content/res/Resources;Ljava/lang/String;I)Landroidx/core/graphics/drawable/IconCompat; in class Landroidx/core/graphics/drawable/IconCompat; or its super classes (declaration of 'androidx.core.graphics.drawable.IconCompat' appears in base.apk)
堆栈跟踪指向我的 NotificationUtils 方法中的这行代码 addAction(R.drawable.ic_baseline_close_24dp, context.getString(R.string.lbl_cancel), cancelIntent)
fun createNotificationBuilder(
context: Context,
notificationTitle: String,
message: String?,
channelId: String,
channelName: String,
contentIntent: PendingIntent = getMainLauncherIntent(context.applicationContext),
cancelIntent: PendingIntent? = null,
showProgress: Boolean = false,
ongoing: Boolean = false,
autoCancel: Boolean = true,
): NotificationCompat.Builder {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel(context.applicationContext, channelId, channelName)
}
val builder = NotificationCompat.Builder(context.applicationContext, channelId).apply {
setContentTitle(notificationTitle)
if (message != null) {
setContentText(message)
}
setTicker(notificationTitle)
setSmallIcon(R.drawable.ic_launcher_foreground)
setContentIntent(contentIntent)
setOngoing(ongoing)
setOnlyAlertOnce(true)
setAutoCancel(autoCancel)
if (showProgress) {
setProgress(MAX_PROGRESS, 0, false)
}
if (cancelIntent != null) {
addAction(R.drawable.ic_baseline_close_24dp, context.getString(R.string.lbl_cancel), cancelIntent)
}
}
return builder
}
但是我似乎无法重现该问题。我看到其他 that mention they had some android support library in libs that was some older android support library, but I don't think I have any. I only have this swipe-reveal-layout library in my libs. My project can be found here.
对我来说,这与 Google Firebase BOM 的 29.0.3 版本有关。 (and/or BOM 中更改的内容,如果您不使用 BOM 而使用特定组件,如果是,请参阅 Firebase BOM 发布页面以了解版本之间的包更改)
还原自:
implementation com.google.firebase:firebase-bom:29.0.3
收件人:
implementation com.google.firebase:firebase-bom:29.0.2
彻底解决了我的问题。我希望这对其他人有帮助。
如果您不使用 BOM,则将 com.google.firebase:firebase-core 和 com.google.firebase:firebase-analytics 都还原为:20.0.1
我最近发布了一个应用到 Google Play,但是我收到了这个错误 -
java.lang.NoSuchMethodError: No static method createWithResource(Landroid/content/res/Resources;Ljava/lang/String;I)Landroidx/core/graphics/drawable/IconCompat; in class Landroidx/core/graphics/drawable/IconCompat; or its super classes (declaration of 'androidx.core.graphics.drawable.IconCompat' appears in base.apk)
堆栈跟踪指向我的 NotificationUtils 方法中的这行代码 addAction(R.drawable.ic_baseline_close_24dp, context.getString(R.string.lbl_cancel), cancelIntent)
fun createNotificationBuilder(
context: Context,
notificationTitle: String,
message: String?,
channelId: String,
channelName: String,
contentIntent: PendingIntent = getMainLauncherIntent(context.applicationContext),
cancelIntent: PendingIntent? = null,
showProgress: Boolean = false,
ongoing: Boolean = false,
autoCancel: Boolean = true,
): NotificationCompat.Builder {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel(context.applicationContext, channelId, channelName)
}
val builder = NotificationCompat.Builder(context.applicationContext, channelId).apply {
setContentTitle(notificationTitle)
if (message != null) {
setContentText(message)
}
setTicker(notificationTitle)
setSmallIcon(R.drawable.ic_launcher_foreground)
setContentIntent(contentIntent)
setOngoing(ongoing)
setOnlyAlertOnce(true)
setAutoCancel(autoCancel)
if (showProgress) {
setProgress(MAX_PROGRESS, 0, false)
}
if (cancelIntent != null) {
addAction(R.drawable.ic_baseline_close_24dp, context.getString(R.string.lbl_cancel), cancelIntent)
}
}
return builder
}
但是我似乎无法重现该问题。我看到其他
对我来说,这与 Google Firebase BOM 的 29.0.3 版本有关。 (and/or BOM 中更改的内容,如果您不使用 BOM 而使用特定组件,如果是,请参阅 Firebase BOM 发布页面以了解版本之间的包更改)
还原自:
implementation com.google.firebase:firebase-bom:29.0.3
收件人:
implementation com.google.firebase:firebase-bom:29.0.2
彻底解决了我的问题。我希望这对其他人有帮助。
如果您不使用 BOM,则将 com.google.firebase:firebase-core 和 com.google.firebase:firebase-analytics 都还原为:20.0.1