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

Reflect issue in minified android apk. Add proguard section in README? #106

Closed
qavan opened this issue Nov 12, 2021 · 6 comments
Closed
Labels
docs 📃 Documentation-related issues

Comments

@qavan
Copy link

qavan commented Nov 12, 2021

Nice lib, thx!

I received kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar error at runtime in minified android build but all my modules includes reflect dependency...

Got correct stacktrace only after cleaning ALL caches (in project, in .gradle transform and build-caches dirs).

Correct stacktrace which helps me fix problem was Property 'unique' (JVM signature: getUnique()Lio/github/serpro69/kfaker/provider/GameOfThrones;) not resolved in class te1
Adding -keepclasseswithmembers class io.github.serpro69.**{*;} in proguard rules and removingandroid.enableR8.fullMode=true fixed problem.

Using non unique getters not receivies exception

@serpro69
Copy link
Owner

Hi @qavan ,
Thanks for reporting this issue.

Just to understand, should we update documentation to reflect usage with android/proguard or do you think there's a need for a fix in the code?

Would you be willing to make a PR for the readme?

@serpro69 serpro69 added the needs info ❓ Further information is requested label Nov 12, 2021
@qavan
Copy link
Author

qavan commented Dec 13, 2021

Hmm, i think reason not in code.
I got same issue with faker 1.9.0, so I think my rule is not correct. Or maybe is only R8 issue for newest kotlin versions(I use Kotlin 1.6.0 with gradle 7.3 + android gradle plugin 7.0.4). According this I can't make 100% helpful pull request, maybe later.

@serpro69
Copy link
Owner

kotlin-faker:1.9.0 uses kotlin 1.6.0 as well - #108 - so if you've tried this version of faker and have the same issue as before, then I doubt it's because of kotlin version discrepancy.

Could you make a sample minimal project to reproduce this issue?

@andrea157
Copy link

Hi, I have a similar problem with obfuscation from 1.6.0, at this link I provided an example project showing the error

@serpro69
Copy link
Owner

Thanks @andrea157 .

I don't think it's an issue with kotlin-faker, especially seeing that your example does not use kotlin-faker at all.
I think the existing proguard rules that are embedded in kotlin-reflect.jar are broken with release 1.6.0+
But I'll play around with this when I have time and see if I can at least add some info to the docs for a workaround. Otherwise feel free to submit a PR for the same.

@serpro69 serpro69 added docs 📃 Documentation-related issues and removed needs info ❓ Further information is requested labels Jan 3, 2022
@serpro69
Copy link
Owner

Hi @qavan ,
This issue has been w/o action for some time now, so I'm going to close it.
Are you still facing problems with proguard in latest kotlin-faker and kotlin versions? If so - feel free to re-open the issue.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs 📃 Documentation-related issues
Projects
None yet
Development

No branches or pull requests

3 participants