chucker icon indicating copy to clipboard operation
chucker copied to clipboard

Cannot resolve symbol ChuckerInterceptor

Open Nesh-Brindha opened this issue 2 years ago • 8 comments

:writing_hand: Describe the bug

I have followed the steps provided in the overview screen https://github.com/ChuckerTeam/chucker. Even after adding the dependency unable to resolve ChuckerInterceptor

:bomb: Steps to reproduce

Step1 : dependencies { debugImplementation "com.github.chuckerteam.chucker:library:3.5.2" releaseImplementation "com.github.chuckerteam.chucker:library-no-op:3.5.2" } Added above dependency in my app build.gradle file Step 2: Trying to add ChuckerInterceptor in my okHttpInterceptor then unable to resolve the ChuckerInterceptor

:wrench: Expected behavior

I should be able to add ChuckerInterceptor without any issue

  • Chucker version: 3.5.2 using latest version

:page_facing_up: Additional context

I have added jitpack library in my maven repository. Adding chucker into application is very straight forward with very minimal steps, not sure why i am facing this issue. Please let me know if i need to add any more dependency to solve my issue

Nesh-Brindha avatar Sep 24 '21 12:09 Nesh-Brindha

I can't help you further without a reproducer. However:

Trying to add ChuckerInterceptor in my okHttpInterceptor then unable to resolve the ChuckerInterceptor

  • Have you done a Gradle Sync just after adding the dependency?
  • Have you tried to build from terminal? Is it working correctly?
  • Could you provide a Gradle Scan: https://scans.gradle.com/

cortinico avatar Sep 30 '21 18:09 cortinico

@Nesh-Brindha Were you able to resolve the issue?

vbuberen avatar Nov 22 '21 19:11 vbuberen

Waiting for an answer as well. I can build my app in debug build fine but when I switch to release build the chucker classes cannot be resolved.

ln206 avatar Dec 02 '21 19:12 ln206

Waiting for an answer as well. I can build my app in debug build fine but when I switch to release build the chucker classes cannot be resolved.

Can you provide a reproducer? As long there is no reproducer for this, I'm leaning towards considering this a problem with your specific buidl configuration

cortinico avatar Dec 02 '21 23:12 cortinico

@cortinico I didn't know what was going on. I actually fixed the problem on my own. I used to have these in my app.gradle:

debugImplementation "com.github.chuckerteam.chucker:library:3.5.2" releaseImplementation "com.github.chuckerteam.chucker:library-no-op:3.5.2"

That didn't work because all the chucker classes are not resolved when I switched to the release build variant.

To fix the issue, I had to use:

implementation "com.github.chuckerteam.chucker:library:3.5.2"

And use this block of code below to only use the ChuckerInterceptor in debug build variant.

if (BuildConfig.DEBUG) { okHttpClientBuilder.addInterceptor(chuckerInterceptor) }

ln206 avatar Dec 02 '21 23:12 ln206

I actually fixed the problem on my own.

I can't call it a fix, since you don't need Chucker classes in your release builds. Could you provide some sample project where the problem can be reproduced?

vbuberen avatar Dec 03 '21 00:12 vbuberen

I can't call it a fix, since you don't need Chucker classes in your release builds.

Agree. You might be good if you're using ProGuard as ChuckerInterceptor gets stripped away given that it's inside a if (BuildConfig.DEBUG) block. Still worth to investigate what's the underlying issue.

cortinico avatar Dec 03 '21 14:12 cortinico

https://scans.gradle.com/s/d3rn3sd44pl2m -- had the same kind of failure, but this was due to my own office VPN.

amitav13 avatar Feb 03 '22 11:02 amitav13