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

Android 9 (API 28) compatibility #293

Closed
bemasc opened this issue Dec 21, 2018 · 3 comments
Closed

Android 9 (API 28) compatibility #293

bemasc opened this issue Dec 21, 2018 · 3 comments

Comments

@bemasc
Copy link

bemasc commented Dec 21, 2018

Caffeine currently cannot be used in apps that target Android 9 (API 28), because Android 9 blocks access to threadLocalRandomProbe as part of the restrictions on non-SDK interfaces.

For more details see micronaut-projects/micronaut-core#124 (comment)

@ben-manes
Copy link
Owner

True, it is lightly touched on in the Guava compatibility, although the reason has changed now. It is not a goal of this project to run on Android.

However, I think we could provide graceful fallback such as to ThreadLocal for broader compatibility. It won't be a goal of this project to target & optimize for Android, though.

@bemasc
Copy link
Author

bemasc commented Dec 21, 2018

Thanks, that sounds like a good plan.

Android does support Java 8, and indeed is running on OpenJDK 8, so perhaps you should revise the rationale there. Caffeine currently works fine on Android API 24-27, but not 28.

bemasc pushed a commit to Jigsaw-Code/Intra that referenced this issue Dec 21, 2018
This change adds DoH-compliant caching and TTL rewriting.
It uses Caffeine, a cache framework that supports custom
expiration times for each entry and load coalescing, so
that a query can be fulfilled from cache if a load action
is in progress for that query.

Caching is disabled by default, subject to a Firebase
remote configuration experiment.

NOTE: Currently this change is blocked by a compatibility
bug in Caffeine: ben-manes/caffeine#293

Fixes #90
@ben-manes
Copy link
Owner

Closing because neither of us originally considered the DEX issue.

Since we codegen to reduce memory footprint, that's good for servers and more troublesome for Android. Users would have to use Proguard and know which classes to keep, which is flaky and annoying. I think Android requires so many different design considerations that Caffeine will never be a good fit. Another library or your custom implementation seems to make a lot more sense.

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

2 participants