Skip to content

[shared_preferences] Fix Android Java version issue #3712

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

Merged

Conversation

stuartmorgan-g
Copy link
Contributor

Sets the compile version to 1.8, which is required by some features added in the switch to Pigeon. This is a standard part of the current Android plugin template, but this plugin predates that template change.

Fixes flutter/flutter#124839

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

Sets the compile version to 1.8, which is required by some features
added in the switch to Pigeon. This is a standard part of the current
Android plugin template, but this plugin predates that template change.

Fixes flutter/flutter#124839
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@stuartmorgan-g
Copy link
Contributor Author

@reidbaker I'm assuming the reason we don't see this in CI is that with a new enough version of everything (Java? Gradle? AGP?) it won't try to compile with 1.7 regardless?

I'm going to do a sweep of all of our plugins to add this anywhere else we don't have it, but I wanted to do this one ASAP to get the fix out since it's breaking a bunch of people (although it will stop breaking new people now that I've retracted 2.1.1).

@AD1N1993

This comment was marked as off-topic.

@reidbaker
Copy link
Contributor

@reidbaker I'm assuming the reason we don't see this in CI is that with a new enough version of everything (Java? Gradle? AGP?) it won't try to compile with 1.7 regardless?

I'm going to do a sweep of all of our plugins to add this anywhere else we don't have it, but I wanted to do this one ASAP to get the fix out since it's breaking a bunch of people (although it will stop breaking new people now that I've retracted 2.1.1).

I just checked the compatibility for all the items I have recently researched.
AGP: https://developer.android.com/build/releases/gradle-plugin
Gradle: https://docs.gradle.org/current/userguide/compatibility.html

This is the only quote that stands out "Java 6 and 7 can still be used for compilation, but are deprecated for use with testing. Testing with Java 6 and 7 will not be supported in Gradle 9.0."

@stuartmorgan-g
Copy link
Contributor Author

I looked around a bit more and found this, which says that the default value is the toolchain's value (which we don't set), and the default toolchain is the "build JVM toolchain".

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 14, 2023
@auto-submit auto-submit bot merged commit e455133 into flutter:main Apr 14, 2023
@stuartmorgan-g stuartmorgan-g deleted the shared-prefs-android-java-version branch April 14, 2023 18:07
@reidbaker
Copy link
Contributor

I looked around a bit more and found this, which says that the default value is the toolchain's value (which we don't set), and the default toolchain is the "build JVM toolchain".

Based on my reading of that link we should be setting toolchain and not source compatibility.

@stuartmorgan-g
Copy link
Contributor Author

Based on my reading of that link we should be setting toolchain and not source compatibility.

I noticed that too, but I'm not clear on what other effects that has (if any). The flutter plugin template, and most of our plugins, currently use sourceCompatibility, so we know it works and is tested, so I went with that as the incremental solution from "definitely wrong" to "on par with the rest of our working code".

It seemed like toolchain was someting we should look into longer term as a potential template change and repo-wide update. I have a note to file it, and will do that on Monday (unless you want to do it first).

@reidbaker
Copy link
Contributor

Based on my reading of that link we should be setting toolchain and not source compatibility.

I noticed that too, but I'm not clear on what other effects that has (if any). The flutter plugin template, and most of our plugins, currently use sourceCompatibility, so we know it works and is tested, so I went with that as the incremental solution from "definitely wrong" to "on par with the rest of our working code".

It seemed like toolchain was someting we should look into longer term as a potential template change and repo-wide update. I have a note to file it, and will do that on Monday (unless you want to do it first).

That makes sense to me.

auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 17, 2023
flutter/packages@e4ec155...0277f2a

2023-04-16 [email protected] Roll Flutter from 00171b0 to 50171bb (7 revisions) (flutter/packages#3723)
2023-04-15 [email protected] Roll Flutter from f740544 to 00171b0 (17 revisions) (flutter/packages#3717)
2023-04-15 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.2.9 to 2.2.12 (flutter/packages#3711)
2023-04-15 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.5.0 to 3.5.2 (flutter/packages#3710)
2023-04-14 [email protected] [path_provider] Fix Android lint warnings (flutter/packages#3706)
2023-04-14 [email protected] [webview_flutter_android] [camera_android_camerax] Updates internal Java InstanceManager to only stop finalization callbacks when stopped (flutter/packages#3571)
2023-04-14 [email protected] [shared_preferences] Fix Android Java version issue (flutter/packages#3712)
2023-04-14 [email protected] [image_picker][android] Non-bitmap images now return path instead of null (flutter/packages#3590)
2023-04-14 [email protected] Roll Flutter from be45eb2 to f740544 (24 revisions) (flutter/packages#3713)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
Sets the compile version to 1.8, which is required by some features added in the switch to Pigeon. This is a standard part of the current Android plugin template, but this plugin predates that template change.

Fixes flutter/flutter#124839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App needs tests p: shared_preferences platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[shared_preferences] not supported in -source 7 errors building on Android
4 participants