Comment réparer: android.app.RemoteServiceException: Bad notification affichée à partir de l'emballage *: impossible de créer une icône: StatusBarIcon

Je vois l'exception suivante dans les journaux des incidents:

android.app.RemoteServiceException: Bad notification posted from package com.my.package: Couldn't create icon: StatusBarIcon(pkg=com.my.package user=0 id=0x7f02015d level=0 visible=true num=0 )
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1456)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5487)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)

Je poste ma Notification d'un IntentService à partir d'un PendingIntent réglée via le AlarmManager à l'aide de la méthode suivante. Toutes les valeurs passées en voici du bundle extras dans le PendingIntent /IntentService.

/**
 * Notification 
 *
 * @param c
 * @param intent
 * @param notificationId
 * @param title
 * @param message
 * @param largeIcon
 * @param smallIcon
 */
public static void showNotification(Context c, Intent intent,
        int notificationId, String title, String message, int largeIcon,
        int smallIcon) {
    PendingIntent detailsIntent = PendingIntent.getActivity(c,
            notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);

    //BUILD
    NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(
            c);
    //TITLE
    mNotifyBuilder.setContentTitle(title).setContentText(message);

    //ICONS
    mNotifyBuilder.setSmallIcon(smallIcon);
    if (Util.isAndroidOSAtLeast(Build.VERSION_CODES.HONEYCOMB)) {
        Bitmap large_icon_bmp = ((BitmapDrawable) c.getResources()
                .getDrawable(largeIcon)).getBitmap();
        mNotifyBuilder.setLargeIcon(large_icon_bmp);
    }

    mNotifyBuilder.setContentIntent(detailsIntent);
    mNotifyBuilder.setVibrate(new long[] { 500, 1500 });
    mNotifyBuilder.setTicker(message);
    mNotifyBuilder.setContentText(message);

    //NOTIFY
    NotificationManager nm = (NotificationManager) c
            .getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(notificationId, mNotifyBuilder.build());
}

De ce que j'ai vu d'autres réponses - à l'exception, j'en vois qui se passe quand setSmallIcon() ne s'appelle pas correctement.

J'ai vérifié et revérifié que l'Id de Ressource étant passé sont tous corrects.

  • Je suis en train de vivre la même erreur (les rapports de plantage à partir d'un live app). Je ne peux pas le reproduire sur mon appareil. Je suis en train de penser que c'est parce que les gens modifié le .apk
  • Les gars, comment puis-je résoudre ce problème. J'utilise le format png, mais très rarement application se bloque
InformationsquelleAutor FishStix | 2014-08-14