簡體   English   中英

Google Play 預發布報告崩潰

[英]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
}

但是我似乎無法重現該問題。 我看到其他一些帖子提到他們在庫中有一些 android 支持庫,但我認為我沒有。 我的庫中只有這個swipe-reveal-layout庫。 我的項目可以在這里找到。

對我來說,這與 Google Firebase BOM 的 29.0.3 版本有關。

恢復自:

com.google.firebase:firebase-bom:29.0.3

至:

com.google.firebase:firebase-bom:29.0.2

徹底解決了我的問題。 我希望這對其他人有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM