https://kotlinlang.org logo
#chucker
Title
# chucker
e

Eddie J

04/02/2022, 4:18 PM
Hi team, I’ve found the strange behavior here which seems to be unrelated 😅. I applied Chucker to my project which has the
ContextWrapper
to wrap the Resources for mostly the string. My codes on that are like:
Copy code
// BaseActivity.java
    @Override
    protected void attachBaseContext(Context newBase) {
        // ResourcesContextWrapper extends from ContextWrapper
        resourcesContextWrapper = ResourcesContextWrapper.wrap(newBase);
        super.attachBaseContext(resourcesContextWrapper);
    }
...
...
...

// In ResourcesContextWrapper.java

    private ResourcesWrapper resourcesWrapper;
    
    @Override
    public Resources getResources() {
        return resourcesWrapper == null ? super.getResources() : resourcesWrapper;
    }
By this code above, when I call:
Copy code
getContext().getResources()
it will return me
ResourcesWrapper
Without Chucker or with Chucker-No-op, the wrapper works fine. Calling
getResources()
returns me
ResourcesWrapper
which is what I need but with Chucker, it keep returning me the default system Resources instead. I’ve tried couple times and still get the same result so I just want to know if it really is unrelated 😅 or somebody has faced this before. Apart from what I mentioned above, every Chucker’s features work fine. Please suggest 🙏
r

radityagumay

04/03/2022, 11:18 PM
let's create a RepRex (Reproducable Example)?
to check whether the issue due to Chucker or not
e

Eddie J

04/04/2022, 7:36 AM
Looks like the issue is actually from the appCompat 😅 . My project still be using the old version 1.0.0 and chucker is using 1.2.0
😂 1
g

gammax

04/04/2022, 11:11 AM
Here you go. You can block the transitive dependency from Chucker if you wish.
6 Views