添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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 Infra upgrades, team productivity, code health, technical debt. See also team: labels. team-android Owned by Android platform team triaged-android Triaged by Android platform team

In flutter/plugins#4206 we are turning on Android linting, but it does not attempt to fix existing issues. Instead, all existing issues have been codified into lint-baseline.xml so that any new issues will be caught by CI.

We should go plugin by plugin and fix (or explicitly disable in a targetted way) all of the issues, and remove both lint-baseline.xml, and the corresponding baseline file("lint-baseline.xml") from build.gradle.

The plugins to be cleaned up are:

  • camera_android - [camera_android] Fix Android lint warnings packages#3716 , [camera] Fix Android lint issues packages#3993
  • camera_android_camerax - [camera] Fix Java lints in camerax version packages#3966
  • espresso
  • flutter_plugin_android_lifecycle - [flutter_plugin_android_lifecycle] Fix lints packages#4030
  • google_maps_flutter_android - [google_maps_flutter_android] Fix Android lint warnings packages#3751
  • google_sign_in_android - [google_sign_in] Fix Android Java warnings packages#3762
  • image_picker_android - [image_picker] Fix Android lints packages#3887
  • in_app_purchase_android - [in_app_purchase] Fix Java lints packages#4032
  • local_auth_android - [local_auth_android] Fix Android lint warnings packages#3764
  • path_provider_android - [path_provider] Fix Android lint warnings packages#3706
  • quick_actions_android - [quick_actions] Fix Android lint issues packages#3885
  • shared_preferences_android - [shared_preferences] Remove Android lint baseline packages#3707
  • url_launcher_android - [url_launcher] Fix Android Java warnings packages#3690
  • video_player_android - [video_player] Fix Android lints packages#3886
  • webview_flutter_android - [webview_flutter_android] Fix Android lint warnings packages#3675
  • [Edit: Updated the list with more plugins since https://github.com/ flutter/packages/pull/3648 adds more baseline files]

    Remove Android lint-baseline.xml files from flutter/plugins Remove Android lint-baseline.xml files from flutter/packages Mar 6, 2023

    For anyone interested in working on this, the process is:

  • Pick a plugin from the list above.
  • Look at the issues in that plugin's android/lint-baseline.xml , and fix any number of the issues there, removing them from the baseline file as they are fixed.
  • For packages that use pigeon , if they aren't using 9.2.3 or later, just updating to the latest version will almost certainly fix some warnings. (For a mass update like this, you can generate a new lint-baseline.xml by deleting the file locally then re-running the lint check.)
  • If you are using Android Studio, see these docs for instruction on enabling the lints in the IDE. By default, most will not show up. (Unfortunately, they must be individually enabled; there is no option to sync them with build.gradle's lint settings.)
  • If you fix all remaining issues, delete the lint-baseline.xml file and remove the baseline file("lint-baseline.xml") entry from android/build.gradle .
  • Fixing all issues in one PR is not required; incremental PRs to reduce the size of lint-baseline.xml are very welcome.
  • Ensure that the lint-android repository tooling command still passes for the plugin.
  • Send a PR with those fixes.
  • Note to anyone finding this via the good first contribution label : this is marked as such because it's a good first contribution specifically in the Android plugin domain . If you don't have any experience with Java, or just aren't interested in plugins, this is not going to be a good first contribution for you.

    (It's not necessary to pre-announce that you are interested in working on this; the chances of two people working on exactly the same fixes at the same time are very low.)

    For all Android plugins: - Enable all warnings for `lint` - Treat all warnings as errors for `lint` This significantly increases the scope of issues that we'll catch in CI. To allow enabling this without having to make tons of fixes first, so that we get the incremental benefit immediately, this adds new baselines for all plugins. We can incrementally clean those baselines up over time. (In practice we haven't prioritized that, but it would be good to start paying down that technical debt incrementally at some point.) See flutter/flutter#88011
    Fixes Android lint warnings found by the `lint-android` repo tool
    command, and removes the baseline file.
    Also fixes a few warnings that showed up in Android Studio.
    Part of flutter/flutter#88011
    Fixes Android lint warnings found by the `lint-android` repo tool
    command, and removes the baseline file.
    Also fixes a few warnings that showed up in Android Studio.
    Part of flutter/flutter#88011
    Removes list-baseline.xml and fixes all violations. Includes a few minor opporunistic fixes of warnings surfaced in Android Studio but not by the linter.
    Part of flutter/flutter#88011
    Removes lint-baseline.xml, fixing all resulting warnings.
    Also makes some fixes that weren't flagged by the command-line lint, but
    were flagged by Android Studio's linter, to reduce the noise in the UI.
    This includes all of the conversions of anonymous subclasses to lambdas,
    which were entirely tool-generated.
    Part of flutter/flutter#88011
    Removes lint-baseline.xml, fixing all resulting warnings.
    Also makes some fixes that weren't flagged by the command-line lint, but
    were flagged by Android Studio's linter, to reduce the noise in the UI.
    This includes all of the conversions of anonymous subclasses to lambdas,
    which were entirely tool-generated.
    Part of flutter/flutter#88011

    Everything is done now except for espresso . That will be non-trivial; there are hundreds of missing nullability violations, and it's all public API, so will require someone to dig into the API structure and make decisions about what the nullability should be (unlike all of the other plugins, where the decision almost always just involved looking at local code).

    Removes lint-baseline.xml, fixing all resulting warnings.
    Also makes some fixes that weren't flagged by the command-line lint, but were flagged by Android Studio's linter, to reduce the noise in the UI. This includes all of the conversions of anonymous subclasses to lambdas, which were entirely tool-generated.
    Part of flutter/flutter#88011
    For all Android plugins: - Enable all warnings for `lint` - Treat all warnings as errors for `lint` This significantly increases the scope of issues that we'll catch in CI. To allow enabling this without having to make tons of fixes first, so that we get the incremental benefit immediately, this adds new baselines for all plugins. We can incrementally clean those baselines up over time. (In practice we haven't prioritized that, but it would be good to start paying down that technical debt incrementally at some point.) See flutter/flutter#88011
    Removes lint-baseline.xml and fixes all exposed lints. Includes an update of Pigeon to the latest version, to pick up warning fixes in generated code.
    Part of flutter/flutter#88011
    For all Android plugins: - Enable all warnings for `lint` - Treat all warnings as errors for `lint` This significantly increases the scope of issues that we'll catch in CI. To allow enabling this without having to make tons of fixes first, so that we get the incremental benefit immediately, this adds new baselines for all plugins. We can incrementally clean those baselines up over time. (In practice we haven't prioritized that, but it would be good to start paying down that technical debt incrementally at some point.) See flutter/flutter#88011
    Removes the lint-baseline.xml file, and fixes all issues. Includes updating to the latest version of Pigeon to pick up the lint fixes for the generated file.
    Part of flutter/flutter#88011
    Removes the lint-baseline.xml file, and fixes all issues.
    The `KotlinPropertyAccess` doesn't seem to work well with generics. For example,
    ```java
    class CameraFeature<T> {
      T getValue();
    class ExposureFeature extends CameraFeature<Exposure> {
      @OverRide
      Exposure getValue() {
    The `ExposureFeature.getValue` causes the lint warning. I went ahead and suppressed this for all `CameraFeatures`.
    I also added `@Nonnull` or `@Nullable` to some private fields that weren't required. This helped deduce whether a value was always nonnull or not.
    Part of flutter/flutter#88011
    Removes lint-baseline.xml, and fixes all resulting warnings. Also fixes some warnings that only show up in the AS linter as opportunistic fixes.
    All anonymous object->lambda conversions were auto-generated by the AS auto-fix for those warnings.
    Fixed an edge case bug found during warning fixes; the Dart `getTokens` call has an argument that was (I assume accidentally) declared as `bool? shouldRecoverAuth = true` instead of `bool shouldRecoverAuth = true`, which means that while it defaults to `true` if not passed, it can be explicitly passed `null` and will keep that value. This was being passed directly into the method channel, and on the Java side was extracted as a `boolean` which would throw an exception on null.
    Part of flutter/flutter#88011
    Removed lint-baseline.xml and fixed all warnings.
    The removal is mainly for unused resources that were identified by the `./gradlew lint` check.
    Part of flutter/flutter#88011
    Removes lint-baseline.xml and fixes all exposed lints. Includes an update of Pigeon to the latest version, to pick up warning fixes in generated code.
    Part of flutter/flutter#88011
    Removes the lint-baseline.xml and fixes the resulting issues. Also does some Andoid-Studio-suggested auto-conversions of anonymous classes to lambdas.
    Part of flutter/flutter#88011
    Fixes the new lints that came with a recent AGP update, and removes the baseline file.
    Fixes flutter/flutter#126710
    Part of flutter/flutter#88011
    Removes list-baseline.xml and fixes all violations. Includes a few minor opporunistic fixes of warnings surfaced in Android Studio but not by the linter.
    Part of flutter/flutter#88011
    For all Android plugins: - Enable all warnings for `lint` - Treat all warnings as errors for `lint` This significantly increases the scope of issues that we'll catch in CI. To allow enabling this without having to make tons of fixes first, so that we get the incremental benefit immediately, this adds new baselines for all plugins. We can incrementally clean those baselines up over time. (In practice we haven't prioritized that, but it would be good to start paying down that technical debt incrementally at some point.) See flutter/flutter#88011 Infra upgrades, team productivity, code health, technical debt. See also team: labels. team-android Owned by Android platform team triaged-android Triaged by Android platform team