Repository navigation
[scroll_overlay] Update to Flutter 3.47 and fix the Android build - #242
Merged
Merged
Conversation
The file was added in 2019 without the "s". Renamed on its own so that the next commit's changes to it show up as edits.
1. Replaced the contents of analysis_options.yaml, a 2019 copy of
flutter/flutter's options, with the file `flutter create` writes
(Flutter 3.47.7).
2. Hand edits to pubspec.yaml:
- Raise SDK constraint to ^3.13.0 to match material_ui.
- Add flutter_lints ^6.0.0.
- Add flutter_test, which the tests import but which only resolved
through integration_test.
- Add publish_to: 'none' and version: 1.0.0+1. The version silences
the "Missing build name" and "Missing build number" warnings in
iOS builds.
The comments for the new lines are copied from the template.
3. flutter pub upgrade
`flutter analyze` reported 3 issues. 1. `dart fix --apply` fixed 2: curly_braces_in_flow_control_structures, prefer_adjacent_string_concatenation. It joins the three debugPrint string literals onto one line (the next commit wraps them). 2. Hand edit for library_private_types_in_public_api: createState() returns State<FlutterDemo>.
Generated with `dart format .` (Dart 3.13.5)
Generated by `flutter build ios --simulator --debug` on Flutter 3.47.7 No hand edits. Tool output: ``` Building com.yourcompany.scrollOverlay for simulator (ios)... Upgrading project.pbxproj Legacy build system detected, removing .../scroll_overlay/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings Project base configurations detected, removing. Upgrading contents.xcworkspacedata Updating minimum iOS deployment target to 15.0. Upgrading project.pbxproj Upgrading AppFrameworkInfo.plist Updating project for Xcode compatibility. Upgrading project.pbxproj Upgrading Runner.xcscheme Upgrading Info.plist Removing script build phase dependency analysis. Adding input path to Thin Binary build phase. Adding Swift Package Manager integration... 3.1s Upgrading Runner.xcscheme To ensure your app continues to launch on upcoming iOS versions, UIScene lifecycle support will soon be required. Please see https://flutter.dev/to/uiscene-migration for the migration guide. Running Xcode build... Xcode build done. 16.0s ✓ Built build/ios/iphonesimulator/Runner.app ```
The old project (Gradle 6.7.1, AGP 4.2.2, `apply from: flutter.gradle`)
no longer builds with current Flutter.
Steps, run from the scroll_overlay directory:
1. rm -rf android
2. flutter create --platforms=android --org io.flutter \
--project-name scroll_overlay -a java .
# --org and -a java keep the app's package name
# (io.flutter.scroll_overlay) and language (Java)
3. git restore pubspec.lock .metadata # unrelated from flutter create
4. rm test/widget_test.dart # template sample test
# Restore the app's native code, layouts and README
5. git restore android/README.md \
android/app/src/main/java \
android/app/src/main/res/layout
# Drop the template's activity (the app has ScrollOverlayActivity)
6. rm android/app/src/main/java/io/flutter/scroll_overlay/MainActivity.java
Then hand edits to make the native side build and run:
- AndroidManifest.xml: launch ScrollOverlayActivity, not the template's
MainActivity.
- android/app/build.gradle.kts: add the RecyclerView dependency the old
project declared, at the end of the file. It stays at 1.2.0 rather
than risk changing the native list that the app compares Flutter's
scrolling against. kotlin-stdlib-jdk7 isn't carried over: the app has
no Kotlin code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings scroll_overlay up to date with Flutter 3.47, still on
package:flutter/material.dart, in preparation for migrating to the material_ui package. This updates and cleans up the flutter config, fixes the broken Android build, and checks in automated iOS migrations.Commits:
analysis_option.yamltoanalysis_options.yaml, on its own, so the next commit shows as edits to it.pubspec.yamlwith SDK version^3.13.0(material_ui's minimum),flutter_lints: ^6.0.0, and explicitflutter_testdependency. Addedpublish_to: 'none', as in other apps, andversion: 1.0.0+1to remove the "Missing build name" and "Missing build number" warnings from iOS builds. Thenflutter pub upgrade.dart fixfor two lints, and a manual fix to havecreateState()returnState<FlutterDemo>.dart format.flutter build ios --simulator --debug, unmodified.flutter create, keeping the app's own Java code, layouts andandroid/README.md. Two small hand edits: the manifest launchesScrollOverlayActivity, the app's entry point, instead of the template'sMainActivity, and RecyclerView dependency is declared at 1.2.0, maintaining the version the old project used.Tested with Flutter 3.47.7:
flutter analyze,flutter testanddart formatare clean. iOS and Android builds don't modify any tracked files. On a Pixel 10 Pro emulator (Android 17), the integration test passes and the app runs in light and dark mode, with the native and Flutter rows lined up. On an iPhone 17 Pro simulator (iOS 26.4), the app runs, and the recordings below replay the same scripted fling onmainand with this PR. Where an injected fling ends varies from run to run.iOS
scroll_overlay_before.mp4
scroll_overlay_after.mp4
Android
Android build was broken before this, so there's only an after version:
android_before.mp4
Unchanged issues/inconsistencies:
There is no tracking issue. This is cleanup before the material_ui migration.
Pre-launch Checklist
I signed the CLA.I listed at least one issue that this PR fixes in the description above.I updated/added relevant documentation (doc comments with///).No new tests: the Dart changes are lint fixes and formatting, and the native project changes were checked by hand on both platforms (above).
Locally,
flutter testpasses, and the integration test passes on Android. On iOS the integration test fails in the same way it did previously.If you need help, consider asking for advice on the #hackers-new channel on Discord.