android throws nullpointerexception at service.startForeground in production

Viewed 393

I'm having this weird exception in production reported by Crashlytics in few users... I don't have really much information so i wasnt't able to reproduce it but i will paste everything crashlytics tells me

@SuppressLint("StringFormatMatches")
private void updateForegroundNotification(ServiceStatus status, Object extra) {

    Intent notificationIntent = new Intent(this, LoginActivity.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

    String text = "sample";

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, Constants.SERVICE_STATUS_NOTIFICATION_CHANNEL_ID)
            .setSmallIcon(R.drawable.ic_notification_logo)
            .setContentTitle(getString(R.string.foregroundNotification))
            .setContentText(text)
            .setPriority(NotificationCompat.PRIORITY_LOW)
            .setContentIntent(pendingIntent);

    startForeground(Constants.ID_FOREGROUND_NOTIFICATION, mBuilder.build());//line 656
}

Stacktrace

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'int com.android.server.am.UidRecord.curProcState' on a null object reference
       at android.os.Parcel.createException(Parcel.java:1959)
       at android.os.Parcel.readException(Parcel.java:1921)
       at android.os.Parcel.readException(Parcel.java:1871)
       at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:5084)
       at android.app.Service.startForeground(Service.java:695)
       at com.tomatedigital.giveawaymaster.service.IgiboService.updateForegroundNotification(IgiboService.java:656)
       at com.tomatedigital.giveawaymaster.service.IgiboService.login(IgiboService.java:292)
       at com.tomatedigital.giveawaymaster.activity.LoginActivity.lambda$doLogin$29(LoginActivity.java:770)
       at com.tomatedigital.giveawaymaster.activity.-$$Lambda$LoginActivity$p3_-EGA6SkYcNhRTdeIvZZogf6k.run(-.java:2)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:764)

does anyone have idea about the cause and how to solve?

0 Answers
Related