Git Product home page Git Product logo

ashok-varma / gander Goto Github PK

View Code? Open in Web Editor NEW
288.0 10.0 38.0 5.63 MB

Gander is a simple in-app HTTP inspector for Android OkHttp clients. Gander intercepts and persists all HTTP requests and responses inside your application, and provides a UI for inspecting their content.

License: Apache License 2.0

Java 100.00%
okhttpclient chuck notifications android gander network-monitoring network-visualization network-debug android-network-status

gander's Issues

Gander and Android 12 (SDK 31) Compatibility

Greetings,
We have been using Gander very happily for the passed few months, but have come across a problem.

When updating our App to target sdk 31 (Android 12), we get the following error message:

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.

Which appears to be occurring inside the Gander library, specifically:

at com.ashokvarma.gander.internal.support.NotificationHelper.show(NotificationHelper.java:81)

.setContentIntent(PendingIntent.getActivity(mContext, 0, Gander.getLaunchIntent(mContext), 0)) <-

We are currently using com.ashokvarma.android:gander-imdb:3.1.0 for our project.

Is there an update to allow gander to work for android 12/SDK31 targeting projects? Or something that can be enabled which would do so?

Thanking you in advance.

Causing app to crash

Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'com.ashokvarma.gander.internal.ui.HttpTransactionUIHelper$Status com.ashokvarma.gander.internal.ui.HttpTransactionUIHelper.getStatus()' on a null object reference com.ashokvarma.gander.internal.support.GanderColorUtil.getTransactionColor (GanderColorUtil.java:58) com.ashokvarma.gander.internal.support.GanderColorUtil.getTransactionColor (GanderColorUtil.java:54) com.ashokvarma.gander.internal.support.NotificationHelper.getNotificationText (NotificationHelper.java:113) com.ashokvarma.gander.internal.support.NotificationHelper.show (NotificationHelper.java:95) com.ashokvarma.gander.GanderInterceptor.create (GanderInterceptor.java:287) com.ashokvarma.gander.GanderInterceptor.createTransactionFromRequest (GanderInterceptor.java:215) com.ashokvarma.gander.GanderInterceptor.intercept (GanderInterceptor.java:154) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147) okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.java:45) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:121) okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.java:93) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:121) okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.java:93) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147) okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.java:127) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:121) com.careclues.physician.development.client.ApiClient.lambda$getClient$0 (ApiClient.java:55) com.careclues.physician.development.client.-$$Lambda$ApiClient$0YUme7uifQFB3wmjrrftotg11_I.intercept (Unknown Source:4) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:121) okhttp3.logging.HttpLoggingInterceptor.intercept (HttpLoggingInterceptor.java:225) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:147) okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:121) okhttp3.RealCall.getResponseWithInterceptorChain (RealCall.java:257) okhttp3.RealCall$AsyncCall.execute (RealCall.java:201) okhttp3.internal.NamedRunnable.run (NamedRunnable.java:32)

AndroidX

Is there migration to androidx planned? I would like to turn off jetifier and this is one of last libraries not to do the migration.

No-op has no Android AAC Lifecycle extensions transitive dependency

The debug version has androidx.lifecycle:lifecycle-extensions:$version" as a transitive dependency, but the no-op don't. I have faced an issue, where I forgot to include that dependency in my project, it worked in debug mode, but in release it failed.

That would be nice to have the same transitive dependencies for each type, even if it is not used, otherwise it is a bug that is really hard to track down.

Feature request: GraphQL implementation

I want to feature for GraphQL.
All response code and title are same.(ref: image ↓

image

Do you think is a good feature? I can open a pull request if you are ok.

Crash on androidx.core:core library update

androidx.core:core update from 1.2.0-alpha02 to 1.3.0-alpha02 causes Notification crash

The error most probably caused by new Notification compat changes (https://developer.android.com/jetpack/androidx/releases/core#1.3.0-alpha01)

Stack Trace:

java.lang.NoClassDefFoundError: androidx.core.graphics.drawable.IconCompat
androidx.core.app.NotificationCompat$Action.(NotificationCompat.java:3303)
com.ashokvarma.gander.internal.support.NotificationHelper.getClearAction(NotificationHelper.java:126)
com.ashokvarma.gander.internal.support.NotificationHelper.show(NotificationHelper.java:107)
com.ashokvarma.gander.GanderInterceptor.create(GanderInterceptor.java:287)
com.ashokvarma.gander.GanderInterceptor.createTransactionFromRequest(GanderInterceptor.java:215)
com.ashokvarma.gander.GanderInterceptor.intercept(GanderInterceptor.java:154)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
io.devlight.data.network.impl.interceptor.PostmanMockInterceptor.intercept(PostmanMockInterceptor.kt:17)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
io.devlight.data.network.impl.interceptor.UTF8Interceptor.intercept(UTF8Interceptor.kt:16)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.kt:219)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
io.devlight.data.network.impl.interceptor.PlatformVersionInterceptor.intercept(PlatformVersionInterceptor.kt:16)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
io.devlight.data.network.impl.interceptor.PlatformInterceptor.intercept(PlatformInterceptor.kt:15)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
io.devlight.data.network.impl.interceptor.AppVersionInterceptor.intercept(AppVersionInterceptor.kt:16)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
io.devlight.data.network.impl.interceptor.LocaleInterceptor.intercept(LocaleInterceptor.kt:21)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
io.devlight.data.network.impl.interceptor.TokenInterceptor.intercept(TokenInterceptor.kt:30)
okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:197)
okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:502)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
java.lang.Thread.run(Thread.java:818)

Specify PendingIntent mutability for Android 12

To be able to target Android 12, all PendingIntent should have a specified mutability.
Reference:

 https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability

E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
    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:375)
        at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
        at android.app.PendingIntent.getActivity(PendingIntent.java:444)
        at android.app.PendingIntent.getActivity(PendingIntent.java:408)
        at com.ashokvarma.gander.internal.support.NotificationHelper.show(NotificationHelper.java:81)
        at com.ashokvarma.gander.GanderInterceptor.create(GanderInterceptor.java:287)
        at com.ashokvarma.gander.GanderInterceptor.createTransactionFromRequest(GanderInterceptor.java:215)
        at com.ashokvarma.gander.GanderInterceptor.intercept(GanderInterceptor.java:154)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
        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:920)

I could find the following references in the code:

NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext, CHANNEL_ID)
.setContentIntent(PendingIntent.getActivity(mContext, 0, Gander.getLaunchIntent(mContext), 0))
.setLocalOnly(true)
.setSmallIcon(R.drawable.gander_ic_notification_white_24dp)
.setColor(ContextCompat.getColor(mContext, R.color.gander_colorPrimary))
.setOngoing(stickyNotification)
.setContentTitle(mContext.getString(R.string.gander_notification_title));

Suggested solution: .setContentIntent(PendingIntent.getActivity(mContext, 0, Gander.getLaunchIntent(mContext), PendingIntent.FLAG_IMMUTABLE))
@NonNull
private NotificationCompat.Action getClearAction() {
CharSequence clearTitle = mContext.getString(R.string.gander_clear);
Intent deleteIntent = new Intent(mContext, ClearTransactionsService.class);
PendingIntent intent = PendingIntent.getService(mContext, 11, deleteIntent, PendingIntent.FLAG_ONE_SHOT);
return new NotificationCompat.Action(R.drawable.gander_ic_delete_white_24dp, clearTitle, intent);
}

Suggested solution: PendingIntent.getService(mContext, 11, deleteIntent, PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE)
@NonNull
private NotificationCompat.Action getDismissAction() {
CharSequence dismissTitle = mContext.getString(R.string.gander_dismiss);
Intent dismissIntent = new Intent(mContext, DismissNotificationService.class);
PendingIntent intent = PendingIntent.getService(mContext, 12, dismissIntent, PendingIntent.FLAG_ONE_SHOT);
return new NotificationCompat.Action(0, dismissTitle, intent);
}

Suggested solution: PendingIntent.getService(mContext, 12, dismissIntent, PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE)

Proposal: No dismissable notification

Hi.

Someone on my team says it could be a good addition to make the notification static, so it cannot be removed from the notifications tray.

Do you think is a good addition? I can open a pull request if you want

StackOverflowError in Release

I'm getting a StackOverflowError in a release build where I have:

releaseImplementation 'com.ashokvarma.android:gander-no-op:3.1.0'

Should this happen?
Is Gander still active in the background in no-op builds?

Attaching a stack trace for reference.

Gander_StackOverFlow_error.txt

Share as text not working

As per title, when trying to share as text, no text is shared.
On a sidenote, share as curl command works.

Tested on gander-persistence 3.1.0

java.lang.IllegalArgumentException

java.lang.IllegalArgumentException: PrecomputedText's Parameters don't match the parameters of this TextView.Consider using setTextMetricsParams(precomputedText.getParams()) to override the settings of this TextView: PrecomputedText: {textSize=54.0, textScaleX=1.0, textSkewX=0.0, letterSpacing=0.0, textLocale=[zh_CN_#Hans], typeface=android.graphics.Typeface@e9694cd9, variationSettings=null, elegantTextHeight=false, textDir=android.text.TextDirectionHeuristics$TextDirectionHeuristicInternal@7722aa5, breakStrategy=1, hyphenationFrequency=1}TextView: {textSize=54.0, textScaleX=1.0, textSkewX=0.0, letterSpacing=0.0, textLocale=[zh_CN_#Hans], typeface=android.graphics.Typeface@e9694cd9, variationSettings=null, elegantTextHeight=false, textDir=android.text.TextDirectionHeuristics$TextDirectionHeuristicInternal@7722aa5, breakStrategy=1, hyphenationFrequency=1}
at android.widget.TextView.setText(TextView.java:6264)
at android.widget.TextView.setText(TextView.java:6180)
at com.ashokvarma.gander.internal.support.TextUtil$1$1.run(TextUtil.java:55)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7037)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

Lint error

We get next lint error after integrated Gander in debug app:

/Users/android_runner_1/.gradle/caches/transforms-2/files-2.1/5890ee85d59f6c9ade9e3338fa7864d2/res/values/values.xml:39: Error: The resource R.font. appears to be unused [UnusedResources]
    <string name="gander_search_request_hint"><font size="12">Search Request and Headers</font></string>
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I was trying to suppress it in our lint.xml but failed with all approaches I tried. Do you have a suggestion how to fix it?

Do you think it is lint bug?

Would you mind to add UnusedResource suppression to the library?

OkHttp 4

Square recently released OkHttp 4. It's a Kotlin porting of OkHttp 3 with some minor changes and will be the basis of all the subsequent Square releases, so it's important to upgrade gander, as it currently crashes when used in an app with OkHttp 4. I can help with a PR but I preferred to write here first to let you know and have your feedback about it.

This is the stack trace:

java.lang.NoSuchMethodError: No static method hasBody(Lokhttp3/Response;)Z in class Lokhttp3/internal/http/HttpHeaders; or its super classes
        at com.ashokvarma.gander.GanderInterceptor.updateTransactionFromResponse(GanderInterceptor.java:250)
        at com.ashokvarma.gander.GanderInterceptor.intercept(GanderInterceptor.java:161)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)

And this is the official thread: square/okhttp#5246 in which square devs advises to not rely on that method, but to copy and paste this one: https://github.com/square/okhttp/blob/eee838aebe8d3524d7e0e2dbf8f9bf357512f038/okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.kt#L213

Gradle verify release resources fails with 2.0.1

Hi and thank you for this great library! Already using version 1.4.0 as a dependency of one of my libraries and it works wonders. Gander is added like this in my android library module:

implementation "com.ashokvarma.android:gander:$gander_version"

So far so good, but this morning when I tried to update the version to 2.0.1, I got this error when generating the aar artifact:

> Task :mylibrary:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mylibrary:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  /Users/goteva/workspace/mylibrary-project/mylibrary/build/intermediates/res/merged/release/layout/gander_act_transaction_details.xml:33: error: attribute tabIndicatorColor (aka com.company.mylibrary:tabIndicatorColor) not found.
  /Users/goteva/workspace/mylibrary-project/mylibrary/build/intermediates/res/merged/release/layout/gander_act_transaction_details.xml:41: error: resource string/appbar_scrolling_view_behavior (aka com.company.mylibrary:string/appbar_scrolling_view_behavior) not found.
  /Users/goteva/workspace/mylibrary-project/mylibrary/build/intermediates/res/merged/release/layout/gander_act_transaction_list.xml:26: error: attribute layoutManager (aka com.company.mylibrary:layoutManager) not found.
  /Users/goteva/workspace/mylibrary-project/mylibrary/build/intermediates/res/merged/release/layout/gander_frag_transaction_payload.xml:39: error: attribute fabSize (aka com.company.mylibrary:fabSize) not found.
  error: failed linking file resources.

It's strange that I have to declare explicitly those values, since I'm fine with the defaults, which should work out of the box.

Those are the versions of my dependencies:

// Gradle classpath dependencies versions
kotlin_version = '1.3.31'
gradle_version = '3.3.0'
maven_gradle_version = '2.1'
gradle_versions_plugin_version = '0.20.0'
bintray_plugin_version = '1.7'

// Library and app testing dependencies versions
junit_version = '4.12'
androidx_test_core_version = '1.2.0'
androidx_test_runner_version = '1.2.0'
androidx_test_rules_version = '1.2.0'
androidx_test_ext_junit_version = '1.1.1'
androidx_test_ext_truth_version = '1.2.0'
truth_version = '0.45'
androidx_test_espresso_version = '3.2.0'

// Library and app dependencies versions
androidx_appcompat_version = '1.0.2'
okhttp_version = "3.14.2"
gson_version = "2.8.5"
retrofit_version = "2.6.0"
rxjava_version = "2.2.9"
rxkotlin_version = "2.3.0"
rxandroid_version = "2.1.1"
gander_version = "2.0.1"

Let me know if you need further details to investigate the error 😉

Proguard configuration

I just tried obfuscated build and got a crash:

java.lang.NullPointerException: Attempt to invoke interface method 'com.ashokvarma.gander.internal.data.TransactionDao com.ashokvarma.gander.internal.data.GanderStorage.getTransactionDao()' on a null object reference
        at com.ashokvarma.gander.GanderInterceptor.create(GanderInterceptor.java:284)
        at com.ashokvarma.gander.GanderInterceptor.createTransactionFromRequest(GanderInterceptor.java:215)
        at com.ashokvarma.gander.GanderInterceptor.intercept(GanderInterceptor.java:154)
        at com.mycomp.common.network.proxy.ProxyOnSubscribe.callProxyRequest(ProxyOnSubscribe.java:141)
        at com.mycomp.common.network.proxy.ProxyOnSubscribe.callProxyRequestAndNotifyEmitter(ProxyOnSubscribe.java:108)
        at com.mycomp.common.network.proxy.ProxyOnSubscribe.subscribe(ProxyOnSubscribe.java:53)
        at io.reactivex.internal.operators.maybe.MaybeCreate.subscribeActual(MaybeCreate.java:45)
        at io.reactivex.Maybe.subscribe(Maybe.java:4290)
        at io.reactivex.internal.operators.maybe.MaybeSubscribeOn$SubscribeTask.run(MaybeSubscribeOn.java:54)
        at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
        at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
        at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        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)

Would be great to have simple proguard configuration added to prevent it.

Logo Proposal

Greetings, Im a graphics designer here on Github and I would like to ask for your permission to design for your logo/icon that you maybe used for your future plans in your project. I want to help open source projects by designing logos or banners for there project. Thank you for your time reading this

Best regards
-jbeguna04

Strict mode warnings

Hi,
I've recently switched on Strict mode in my app with these settings:

if (BuildConfig.DEBUG) {
        StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder()
            .detectDiskReads()
            .detectDiskWrites()
            .detectNetwork()
            .build())

        StrictMode.setVmPolicy(StrictMode.VmPolicy.Builder()
            .detectLeakedSqlLiteObjects()
            .detectLeakedClosableObjects()
            .penaltyLog()
            .build())
    }

And I've been getting spammed with this stacktrace since:

2019-06-27 18:28:00.663 13773-13780/com.buyceps.kiosk E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
    java.lang.Throwable: Explicit termination method 'end' not called
        at dalvik.system.CloseGuard.open(CloseGuard.java:180)
        at java.util.zip.Inflater.<init>(Inflater.java:104)
        at okio.GzipSource.<init>(GzipSource.java:62)
        at com.ashokvarma.gander.GanderInterceptor.getNativeSource(GanderInterceptor.java:358)
        at com.ashokvarma.gander.GanderInterceptor.getNativeSource(GanderInterceptor.java:370)
        at com.ashokvarma.gander.GanderInterceptor.updateTransactionFromResponse(GanderInterceptor.java:248)
        at com.ashokvarma.gander.GanderInterceptor.intercept(GanderInterceptor.java:160)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:225)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at com.valartech.commons.network.retrofit.AuthHeaderInterceptor.intercept(AuthHeaderInterceptor.kt:32)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:250)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:201)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

The offending line seems to be this one in GanderInterceptor.java:

@NonNull
    private BufferedSource getNativeSource(@NonNull BufferedSource input, boolean isGzipped) {
        if (isGzipped) {
            GzipSource source = new GzipSource(input); //this one
            return Okio.buffer(source);
        } else {
            return input;
        }
    }

Add dependencies in pom.xml

Problem

After updating this library to 2.0.1 (from 1.4.0), the app crashes when tapping on the notification / opening the Gander Intent because the PagedListAdapter could not be found.
Stacktrace:

FATAL EXCEPTION: main
    Process: [my.application.id.redacted], PID: 25551
    java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/paging/PagedListAdapter;
        at java.lang.Class.newInstance(Native Method)
        at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
        at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:43)
        [...]
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.paging.PagedListAdapter" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/my.application.id.redacted-FPnU4r2hjkGlbkGlYtumgg==/base.apk"],nativeLibraryDirectories=[/data/app/my.application.id.redacted-FPnU4r2hjkGlbkGlYtumgg==/lib/arm64, /data/app/my.application.id.redacted-FPnU4r2hjkGlbkGlYtumgg==/base.apk!/lib/arm64-v8a, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        [...]

The application itself does not use the PagedListAdapter and therefore does not declare a dependency for it.

So the easy solution is to just add the missing dependencies needed by gander (in my case androidx.paging:paging-runtime and androidx.lifecycle:lifecycle-extensions).

Cleaner Solution

To not force the library users to declare the missing dependencies in their applications, it would be nice to have the required dependencies of this library declared within its pom.xml.
An example to do so can be found here: https://stackoverflow.com/a/30523571/5045290 (I'm not that familiar with your maven deployment process, though).

I'm happy to provide a PR for that, however, the final implementation / testing would need to be performed by the library owner.

Update Room to remove need for Jetifying

Gander-Persistance is using a pre-androidx version of Room. Is there a plan to update to the latest, or if not, at least an androidx version such that projects with Gander won't need to jetify for Gander?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.