简体   繁体   English

Google Play 预发布报告崩溃

[英]Google Play Prelaunch Report Crash

I recently released an app to Google Play, however I'm getting this error -我最近向 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)

The stack trace points to this line of code addAction(R.drawable.ic_baseline_close_24dp, context.getString(R.string.lbl_cancel), cancelIntent) in my NotificationUtils method堆栈跟踪指向我的 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
}

However I can't seem to reproduce the issue.但是我似乎无法重现该问题。 I see some other posts 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.我看到其他一些帖子提到他们在库中有一些 android 支持库,但我认为我没有。 I only have this swipe-reveal-layout library in my libs.我的库中只有这个swipe-reveal-layout库。 My project can be found here .我的项目可以在这里找到。

For me, this was related to the 29.0.3 elease of Google Firebase BOM.对我来说,这与 Google Firebase BOM 的 29.0.3 版本有关。

Reverting from:恢复自:

com.google.firebase:firebase-bom:29.0.3 com.google.firebase:firebase-bom:29.0.3

To:至:

com.google.firebase:firebase-bom:29.0.2 com.google.firebase:firebase-bom:29.0.2

Completely solved my issue.彻底解决了我的问题。 I hope this helps others.我希望这对其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM