Skip to content

[BUG] Lint reports an error #4485

Open
Open

Description

@hannesa2

I guess you don't run lint during the pull request pipeline, otherwise you would see during

./gradlew :owncloudApp:lintDebug

this

              Lint found 1 errors, 847 warnings. First failure:

/Users/hannes/git/owncloud-android/owncloudApp/src/main/java/com/owncloud/android/extensions/FragmentExt.kt:89: Error: Wrong usage of repeatOnLifecycle from ManageAccountsDialogFragment.onStart. [RepeatOnLifecycleWrongUsage from androidx.lifecycle]
repeatOnLifecycle(lifecycleState) {
^

 Explanation for issues of type "RepeatOnLifecycleWrongUsage":
 The repeatOnLifecycle APIs should be used when the View is created,        
         that is in the onCreate lifecycle method for Activities, or
 onViewCreated in                 case you're using Fragments.

 Vendor: Android Open Source Project
 Identifier: androidx.lifecycle
 Feedback: https://issuetracker.google.com/issues/new?component=413132

Activity

  1. jesmrec commented on Oct 2, 2024

    @jesmrec
    Member

    About the warnings, we are working in adding an static code analyzer to the CI system. We hope it'll be ready soon to help to avoid/fix such amount of warnings.

    Will take a look to the error.

    Thanks for reporting

  2. changed the title [-][BUG]Lint reports an error[/-] [+][BUG] Lint reports an error[/+] on Oct 3, 2024
  3. added this to the Backlog milestone on Oct 4, 2024
  4. removed this from the Backlog milestone on Feb 14, 2025
  5. hannesa2 commented on Jun 14, 2025

    @hannesa2
    ContributorAuthor

    I guess you still don't run ./gradlew lint in your CI
    On recent master 3caa33f , there are still issues

    Image
  6. jesmrec commented on Jun 16, 2025

    @jesmrec
    Member

    i executed lint locally and my result was green, but anyway, you are right. We are moving our pipelines from BitRise to GitHub Actions, and the lint part is missing there. Another workflow for lint could be a good idea. We'll take this as a nice improvement to do, or, if you'd like to contribute on that you know you are welcome 🥇

  7. hannesa2 commented on Jun 16, 2025

    @hannesa2
    ContributorAuthor

    We are moving our pipelines from BitRise to GitHub Actions

    Finally after 5 years ! #2816
    This was one reason why I reduced my affords here to a minimum

  8. jesmrec commented on Jun 16, 2025

    @jesmrec
    Member

    well, lint was integrated and runing on bitrise, as well as the other jobs running on CI. Now everything running in GA... not five years but i can understand your disappointment.

  9. added this to the 4.7 - Next milestone on Jun 20, 2025
  10. DeepDiver1975 commented on Jul 2, 2026

    @DeepDiver1975
    Contributor

    Still reproducible on current master.

    Lint error (real, not suppressed):

    • ManageAccountsDialogFragment.onStart() → subscribeToViewModels() calls collectLatestLifecycleFlow(...) at ManageAccountsDialogFragment.kt:210 and :230.
    • That helper runs repeatOnLifecycle(...) at FragmentExt.kt:108.
    • repeatOnLifecycle is called from onStart, not from a View-scoped callback → RepeatOnLifecycleWrongUsage. androidx guidance: use it in onViewCreated (Fragments) / onCreate (Activities). Since this is a DialogFragment with no content view, collect from onCreate (or a viewLifecycleOwner-tied scope), not onStart.
    • owncloudApp/lint.xml only ignores MissingTranslation/MissingQuantity, so this error is not suppressed.

    Why CI still misses it: the GH Actions migration added a detekt workflow, but Detekt does not run Android Lint — RepeatOnLifecycleWrongUsage is an androidx.lifecycle Lint check. No workflow runs ./gradlew lintDebug, so the error stays green in CI. A lint workflow (or a lintDebug step) would catch it.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions