Skip to content

Patrol is built into a release app, even when it is a dev_dependency #681

Open

Description

@bartekpacia

That's what Apple sent us after we released an app using patrol v0.10.2 on Test Flight.

IMG_5924

This is the line which is causing this warning.

It also hints at a much bigger problem – Patrol's native code is built into an app binary in release mode, which increases its size. I haven't done any benchmarks, but gRPC which we're using isn't known for being lightweight...

cc @mateuszwojtczak

Related issues:

Activity

  1. self-assigned this
    on Dec 16, 2022
  2. changed the title [-]Patrol is built into a release APK[/-] [+]Patrol is built into a release app, which App Store doesn't allow for[/+] on Dec 16, 2022
  3. changed the title [-]Patrol is built into a release app, which App Store doesn't allow for[/-] [+]Patrol is built into a release app[/+] on Dec 18, 2022
  4. changed the title [-]Patrol is built into a release app[/-] [+]Patrol is built into a release app, even when it is a dev_dependency[/+] on Dec 18, 2022
  5. bartekpacia commented on Dec 19, 2022

    @bartekpacia
    ContributorAuthor

    (Android) Verify that Patrol's code is built into the app

    1. Build the app (debug mode, release mode - shouldn't matter. We're a dev_dependency, so we shouldn't be included anyway).

      $ flutter build apk
      
    2. Use apkanalyzer to see that Patrol's code is included in the resulting dex:

      # run in the directory with app's pubspec.yaml
      $ apkanalyzer -h dex packages build/app/outputs/flutter-apk/app-debug.apk | grep pl.leancode.patrol | wc -l 
      

      In my case, it prints 5112, but it should be 0 instead.

    The same can be done for other dev_dependencies that shouldn't land in the app binary, but they do, e.g. integration_test:

    $ apkanalyzer -h dex packages build/app/outputs/flutter-apk/app-debug.apk | grep integration_test | wc -l
         344
    
  6. KonAtPropertyMe commented on Dec 21, 2022

    @KonAtPropertyMe

    Got the same issue @bartekpacia. Looking forward to a fix, although it is not stopping us as we dropped back to 0.9.1 for now.

  7. bartekpacia commented on Dec 21, 2022

    @bartekpacia
    ContributorAuthor

    @KonAtPropertyMe I'm working on a fix (or rather a nicer workaround, because the root cause lies in Flutter itself)

    For the time being, you can update to the newest Patrol (v0.10.5) and use the below script (made by @jarekb123) to remove dependency on patrol in your CI:

    # This script is run before fastlane build (mainly iOS build)
    #
    # It's a workaround for Apple app rejection: 
    # ITMS-90338: Non-public API usage - The app references non-public selectors in Frameworks/patrol.framework/patrol: terminate.
    
    cp pubspec.yaml pubspec_copy.yaml
    sed '/patrol/d' pubspec_copy.yaml > pubspec.yaml
    rm pubspec_copy.yaml
    flutter pub get
  8. bartekpacia commented on Jan 12, 2023

    @bartekpacia
    ContributorAuthor

    #727 introduced a workaround for this. Now the terminate() function that App Store is angry about is guarded by an #ifdef, which by default evaluates to false.

  9. jeremiahlukus commented on Mar 15, 2023

    @jeremiahlukus

    Still getting this on the latest version

    The app references non-public selectors in Payload/Runner.app/Frameworks/patrol.framework/patrol: alerts, exists, isHittable, launch, sharedDevice, tap
    
  10. bartekpacia commented on Mar 15, 2023

    @bartekpacia
    ContributorAuthor

    Oh, so that means App Store has broadened its definition of "non-public selectors". We need to get this fixed ASAP. cc @jBorkowska @mateuszwojtczak - this prevents apps that import patrol to be published on App Store.

    @jeremiahlukus For now, you can remove the patrol dependency automatically before building a binary that gets uploaded to App Store.

  11. bartekpacia commented on Mar 17, 2023

    @bartekpacia
    ContributorAuthor

    This should be fixed (again) in v1.0.8.

  12. bartekpacia commented on Apr 3, 2023

    @bartekpacia
    ContributorAuthor

    This is still a problem. Yes, we do have a workaround implemented, but we'd like to see it fixed upstream :)

  13. removed their assignment
    on Nov 20, 2023
  14. emakar commented on Feb 13, 2025

    @emakar
  15. ahlstro commented on Mar 19, 2025

    @ahlstro
    Contributor

    Should this be open? We are experiencing increased build time and size in release app, could it be this or is it fixed in latest patrol version?

  16. creativecreatorormaybenot commented on Mar 31, 2025

    @creativecreatorormaybenot
    Contributor

    @ahlstro this issue is still open. Only the Flutter issue linked by @emakar is closed.

  17. emakar commented on Sep 12, 2025

    @emakar

    this should be resolved now in 3.35 with flutter/flutter#160443 (comment)

    however, another issue arises - assets from dev_dependencies are included for flutter test, and when running tests with patrol - no dev assets are bundled at all

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

    blockedBlocked by external factorsbugSomething isn't workingplatform: iosiOS is affected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions