chucker icon indicating copy to clipboard operation
chucker copied to clipboard

Chucker library not working for Android 13

Open anjali-purohit opened this issue 2 years ago • 13 comments

:writing_hand: Describe the bug

Chucker library not working for Android 13

:bomb: Steps to reproduce

Reproduce the behavior:

  1. Update the compileSDK and targetSDK version to 33
  2. Add chucker dependency in build.gradle implementation "com.github.chuckerteam.chucker:library:3.5.2"
  3. Add below code in your OkHttpClient builder ChuckerCollector chuckerCollector = new ChuckerCollector(context, true, RetentionManager.Period.ONE_HOUR); ChuckerInterceptor chuckerInterceptor = new ChuckerInterceptor.Builder(context) .collector(chuckerCollector) .maxContentLength(250_000L) .alwaysReadResponseBody(true) .build();

:wrench: Expected behavior

When the app is launched, the network logs should get displayed on the notification panel

:Android: Tech info

  • Device: Pixel 4 XL
  • OS: Android 13
  • Chucker version: 3.5.2

:page_facing_up: Additional context

Chucker library was working fine till Android 12. After upgrading the app to Android 13, I am not getting the http logs.

Is it supporting Android 13 or not ?

If it's supporting then how to integrate it.

anjali-purohit avatar Jul 20 '22 18:07 anjali-purohit

We have a template for bug reports for a reason.

Provide information according to provided template, so we could help you.

vbuberen avatar Jul 20 '22 19:07 vbuberen

If it's supporting then how to integrate it.

Please fill in the issue template as suggested by @vbuberen

Also what is the issue you're facing?

cortinico avatar Jul 30 '22 16:07 cortinico

@anjali-purohit your problem is likely that Chucker is unable to display the notification because you haven't requested the new POST_NOTIFICATION runtime permission. You'd need to add this permission to your manifest, and request it at runtime like you would a location permission before Chucker will be able to display the notification.

Docs

hibob224 avatar Aug 03 '22 22:08 hibob224

@anjali-purohit your problem is likely that Chucker is unable to display the notification because you haven't requested the new POST_NOTIFICATION runtime permission. You'd need to add this permission to your manifest, and request it at runtime like you would a location permission before Chucker will be able to display the notification.

Docs

I tried this one. but it's still not working on me.

fadhyyusuf avatar Aug 04 '22 14:08 fadhyyusuf

Hey, please see this trace logs taken while trying to migrate an app from android API 30 to 33. It seems Chucker lib is not yet updated to use the flags from PendingIntent. Maybe this is the same issue @anjali-purohit is referring to. Or should I create a new issue?

    java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:378)
        at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461)
        at android.app.PendingIntent.getActivity(PendingIntent.java:447)
        at android.app.PendingIntent.getActivity(PendingIntent.java:411)
        at com.chuckerteam.chucker.internal.support.NotificationHelper$transactionsScreenIntent$2.invoke(NotificationHelper.kt:47)
        at com.chuckerteam.chucker.internal.support.NotificationHelper$transactionsScreenIntent$2.invoke(NotificationHelper.kt:19)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.chuckerteam.chucker.internal.support.NotificationHelper.getTransactionsScreenIntent(Unknown Source:2)
        at com.chuckerteam.chucker.internal.support.NotificationHelper.show(NotificationHelper.kt:101)
        at com.chuckerteam.chucker.api.ChuckerCollector.onRequestSent$com_github_ChuckerTeam_Chucker_library(ChuckerCollector.kt:65)
        at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept(ChuckerInterceptor.kt:111)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)
        at okhttp3.RealCall.execute(RealCall.java:93)
        at com.newrelic.agent.android.instrumentation.okhttp3.CallExtension.execute(CallExtension.java:45)
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:188)
        at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:104)

gungureanu-grubhub avatar Aug 04 '22 14:08 gungureanu-grubhub

Hey, please see this trace logs taken while trying to migrate an app from android API 30 to 33. It seems Chucker lib is not yet updated to use the flags from PendingIntent. Maybe this is the same issue @anjali-purohit is referring to. Or should I create a new issue?

    java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:378)
        at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461)
        at android.app.PendingIntent.getActivity(PendingIntent.java:447)
        at android.app.PendingIntent.getActivity(PendingIntent.java:411)
        at com.chuckerteam.chucker.internal.support.NotificationHelper$transactionsScreenIntent$2.invoke(NotificationHelper.kt:47)
        at com.chuckerteam.chucker.internal.support.NotificationHelper$transactionsScreenIntent$2.invoke(NotificationHelper.kt:19)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.chuckerteam.chucker.internal.support.NotificationHelper.getTransactionsScreenIntent(Unknown Source:2)
        at com.chuckerteam.chucker.internal.support.NotificationHelper.show(NotificationHelper.kt:101)
        at com.chuckerteam.chucker.api.ChuckerCollector.onRequestSent$com_github_ChuckerTeam_Chucker_library(ChuckerCollector.kt:65)
        at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept(ChuckerInterceptor.kt:111)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)
        at okhttp3.RealCall.execute(RealCall.java:93)
        at com.newrelic.agent.android.instrumentation.okhttp3.CallExtension.execute(CallExtension.java:45)
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:188)
        at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:104)

Which version of the library are you using? This was fixed for Android 12 support last year - Commit

hibob224 avatar Aug 04 '22 15:08 hibob224

Hey, please see this trace logs taken while trying to migrate an app from android API 30 to 33. It seems Chucker lib is not yet updated to use the flags from PendingIntent. Maybe this is the same issue @anjali-purohit is referring to. Or should I create a new issue?

    java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:378)
        at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461)
        at android.app.PendingIntent.getActivity(PendingIntent.java:447)
        at android.app.PendingIntent.getActivity(PendingIntent.java:411)
        at com.chuckerteam.chucker.internal.support.NotificationHelper$transactionsScreenIntent$2.invoke(NotificationHelper.kt:47)
        at com.chuckerteam.chucker.internal.support.NotificationHelper$transactionsScreenIntent$2.invoke(NotificationHelper.kt:19)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.chuckerteam.chucker.internal.support.NotificationHelper.getTransactionsScreenIntent(Unknown Source:2)
        at com.chuckerteam.chucker.internal.support.NotificationHelper.show(NotificationHelper.kt:101)
        at com.chuckerteam.chucker.api.ChuckerCollector.onRequestSent$com_github_ChuckerTeam_Chucker_library(ChuckerCollector.kt:65)
        at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept(ChuckerInterceptor.kt:111)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)
        at okhttp3.RealCall.execute(RealCall.java:93)
        at com.newrelic.agent.android.instrumentation.okhttp3.CallExtension.execute(CallExtension.java:45)
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:188)
        at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:104)

Which version of the library are you using? This was fixed for Android 12 support last year - Commit

hmm, it seems I need to upgrade the lib. I was using an older version. Thanks

gungureanu-grubhub avatar Aug 04 '22 15:08 gungureanu-grubhub

Hey, please see this trace logs taken while trying to migrate an app from android API 30 to 33. It seems Chucker lib is not yet updated to use the flags from PendingIntent. Maybe this is the same issue @anjali-purohit is referring to. Or should I create a new issue?

    java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:378)
        at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461)
        at android.app.PendingIntent.getActivity(PendingIntent.java:447)
        at android.app.PendingIntent.getActivity(PendingIntent.java:411)
        at com.chuckerteam.chucker.internal.support.NotificationHelper$transactionsScreenIntent$2.invoke(NotificationHelper.kt:47)
        at com.chuckerteam.chucker.internal.support.NotificationHelper$transactionsScreenIntent$2.invoke(NotificationHelper.kt:19)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.chuckerteam.chucker.internal.support.NotificationHelper.getTransactionsScreenIntent(Unknown Source:2)
        at com.chuckerteam.chucker.internal.support.NotificationHelper.show(NotificationHelper.kt:101)
        at com.chuckerteam.chucker.api.ChuckerCollector.onRequestSent$com_github_ChuckerTeam_Chucker_library(ChuckerCollector.kt:65)
        at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept(ChuckerInterceptor.kt:111)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)
        at okhttp3.RealCall.execute(RealCall.java:93)
        at com.newrelic.agent.android.instrumentation.okhttp3.CallExtension.execute(CallExtension.java:45)
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:188)
        at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:104)

This is a different issue which can be fixed after updating the flags.

anjali-purohit avatar Aug 05 '22 16:08 anjali-purohit

@anjali-purohit your problem is likely that Chucker is unable to display the notification because you haven't requested the new POST_NOTIFICATION runtime permission. You'd need to add this permission to your manifest, and request it at runtime like you would a location permission before Chucker will be able to display the notification.

Docs

Thanks !! I have tried this solution but even after adding the <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> permission, it is not displaying any logs.

anjali-purohit avatar Aug 05 '22 16:08 anjali-purohit

We have a template for bug reports for a reason.

Provide information according to provided template, so we could help you.

Sure. I will update. Thanks !!

anjali-purohit avatar Aug 05 '22 16:08 anjali-purohit

I also face the same issue. I recently updated my app to compileSdkVersion and targetSdkVersion 32 and the notification stop displaying. I'm using 3.5.2. It might be Android 12L and Android 13 issue. If will be great it's fixed soon.

logosdeborah avatar Aug 08 '22 20:08 logosdeborah

Hi @vbuberen , Any update on this issue ?

Nesh-Brindha avatar Sep 07 '22 10:09 Nesh-Brindha

It is just notifications are missing, rest of functionality works. Transactions data is available if you open Chucker via an Android shortcut which is added by default to the app. Suggest to use it till update arrives.

I am working on it, but Chucker isn't something that has priority for me at the moment, so no timelines about the solution.

vbuberen avatar Sep 08 '22 18:09 vbuberen