Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The adapter always returns null when using Android's R8 minification #5

Open
Paul-Etienne opened this issue Nov 30, 2023 · 1 comment

Comments

@Paul-Etienne
Copy link

Hello, first of all, I don't know if you're still maintaining this repo, but in case you do, here's a problem I'm facing at the moment.

I was using your adapter class to convert Retrofit's responses into Kotlin Result<T> type, which was working perfectly in debug mode, without R8 enabled. But I'm now trying to build a release version with R8 enabled, and as soon as the response reaches the adapter, I always end up receiving a null value.

I'm guessing some Proguard rules are necessary to make your adapter work, I'm still trying to figure out which rules to add though. I assume it's tied to the reflection part. I'll post here if I manage to find rules that work, otherwise if you have time you can have a look as well.

@Paul-Etienne Paul-Etienne changed the title The adapter always returns null when using R8 minification The adapter always returns null when using Android's R8 minification Nov 30, 2023
@Paul-Etienne
Copy link
Author

I've just realized I don't necessarily need this adapter returning Kotlin's Result<T> type. I've just noticed I can simply use Retrofit's Response<T> type thanks to that SO post. I didn't need to change much code in my application and this type is compatible out of the box with Proguard's minification, so I'm just gonna go with that.

I won't spend more time looking for a Proguard rule that would fix this repo's adapter solution. I'll leave the issue open in case somebody really needs to have a Result<T> type and have R8 enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant