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

R8: Missing class org.jetbrains.annotations.NotNull when minifyEnabled is true #842

Closed
mhsmith opened this issue Apr 4, 2023 · 2 comments
Labels
Milestone

Comments

@mhsmith
Copy link
Member

mhsmith commented Apr 4, 2023

This was a warning in older AGP versions, but it's become an error in AGP 8.0:

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/msmith/git/chaquo/chaquopy/product/gradle-plugin/build/test/integration/8.0/JavaLib/minify/project/app/build/outputs/mapping/debug/missing_rules.txt.
ERROR: R8: Missing class org.jetbrains.annotations.NotNull (referenced from: java.lang.String com.chaquo.python.Kwarg.key and 34 other contexts)

For now it can be worked around by adding this line to the project's proguard-rules.pro file:

-dontwarn org.jetbrains.annotations.NotNull

Keywords: minify

@mhsmith mhsmith added the bug label Apr 4, 2023
@mhsmith
Copy link
Member Author

mhsmith commented Apr 4, 2023

Notes to self for doing a proper fix:

  • First, remove the dontwarn workaround which I put in the plugin's proguard-rules.pro file.

  • NotNull is provided by org.jetbrains:annotations-java5:15.0, which is a dependency of the Chaquopy Java library. Changing the dependency scope from implementation to compile didn't help, but it's probably a good idea to do that anyway, since the annotations are part of the public API.

  • I suspect the annotations library isn't being included in the app build because the plugin adds the Chaquopy library indirectly, by creating a configuration in the buildscript project and then wrapping it with files to bring it into the app module. Start off by examining exactly which files are being returned by files. Perhaps we need to "resolve" the configuration before using it.

  • This has always been an awkward area, so check the previous related issues to make sure we don't cause any regressions.

@mhsmith mhsmith added this to the 14.1 milestone Apr 4, 2023
@mhsmith mhsmith changed the title R8: Missing class org.jetbrains.annotations.NotNull R8: Missing class org.jetbrains.annotations.NotNull when minifyEnabled is true Apr 4, 2023
@mhsmith
Copy link
Member Author

mhsmith commented May 16, 2023

When I originally created this issue, I think I could reproduce it with the Chaquopy development version and the AGP 8.0 RC. I can still reproduce it by running JavaLib.test_minify with Chaquopy 14.0.2 and AGP 8.0.1. But I can't reproduce it with the development version of Chaquopy anymore, either on Mac or Linux.

I've no idea why this has happened, but unless it comes up again, I don't think it's worth looking into any further.

@mhsmith mhsmith closed this as completed May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant