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
Fix assembleAndroidTest builds #466
Conversation
…uild for Android instrumented tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
irony: android gradle plugin 4.2.0 defaults to java 8 so this is unnecessary for builds using current stable build tool chains as of...this week. But everyone won't upgrade immediately of course.
I don't see any reason why this wouldn't work - it's a best practice anyway. Interesting it hasn't popped up before actually?
Yeah I only tend to see it in projects that have instrumented Android tests, so perhaps not enough projects are writing tests 😆 |
Just following up on this. Anything else you need me to change or answer before this PR is merged? |
Nope I think we're just waiting on @matt-oakes to whack the merge button, until then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still needed for some old projects, no reason not to merge, and I can merge now
## [6.1.1](v6.1.0...v6.1.1) (2021-11-13) ### Bug Fixes * **android:** declare java 1.8 feature usage so assembleInstrumentedTest builds work ([#466](#466)) ([48d4364](48d4364))
🎉 This PR is included in version 6.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Overview
Fixes an issue when building and running instrumented tests (e.g. Detox) for a React Native project on Android, the following build error was occurring:
If an Android library uses Java 8 language features then it must declare
compileOptions
in itsbuild.gradle
.https://developer.android.com/studio/write/java8-support#supported_features
Fix is simple to add Java 8
compileOptions
to thebuild.gradle
. I've seen and fixed similar issues in other projects as well:negativetwelve/react-native-ux-cam#104
snowplow/snowplow-react-native-tracker#117
Test Plan
Made the change locally in my projects
node_modules
, then rebuilt the app, and it was successful 🎉 .