shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
2.19k stars 131 forks source link

Unexpected native changes warning when patching an Android release #2270

Closed bryanoltman closed 2 months ago

bryanoltman commented 2 months ago

When running shorebird patch android, Discord user michaelgolfi is reporting seeing an unexpected native changes warning (thread):

[WARN] Your app contains native changes, which cannot be applied with a patch.
    Changed files:
        base/dex/classes2.dex

Their pubspec.yaml file (organized for readability):

name: mobile_app
publish_to: none
version: 0.0.1+1

environment:
  sdk: ">=2.18.0 <4.0.0"

dependencies:
  add_2_calendar: 3.0.1
  animated_toggle_switch: 0.8.1
  async: 2.11.0
  back_button_interceptor: 7.0.3
  badges: 3.1.2
  battery_plus: 6.0.1
  bubble_box: 0.5.3
  built_collection: 5.1.1
  built_value: 8.7.0
  calendar_date_picker2: 0.5.3
  collection: 1.18.0
  components:
    path: ../lib/components
  connectivity_plus: 6.0.3
  convert: 3.1.1
  cookie_jar: 4.0.8
  cr_file_saver:
    git:
      ref: 1db62fd53adf9b34d4b769788d6c4be4fa416817
      url: https://github.com/crit-iq/cr_file_saver.git
  crypto: 3.0.3
  device_info_plus: 9.0.2
  easy_rich_text: 2.1.0
  email_validator: 2.1.17
  extended_image: 8.2.0
  facebook_app_events: 0.19.2
  ferry: 0.15.0+1
  ferry_flutter: 0.9.0
  ferry_hive_store: 0.5.2
  firebase_analytics: 11.0.0
  firebase_core: 3.0.0
  firebase_crashlytics: 4.0.0
  firebase_messaging: 15.0.0
  firebase_performance: 0.10.0
  flutter:
    sdk: flutter
  flutter_animation_progress_bar: 2.3.1
  flutter_branch_sdk: 8.0.2
  flutter_facebook_auth: 6.2.0
  flutter_image_compress: 2.3.0
  flutter_localizations:
    sdk: flutter
  flutter_markdown: 0.7.1
  flutter_multi_formatter: 2.12.3
  flutter_svg: 2.0.9
  get_it: 7.7.0
  golden_toolkit: 0.15.0
  google_fonts: 6.1.0
  google_sign_in: 6.2.1
  gql: 1.0.1-alpha+1699832453526
  gql_code_builder: 0.9.1+1
  gql_dedupe_link: 2.0.4-alpha+1699832453607
  gql_exec: 1.1.1-alpha+1699813812660
  gql_http_link: 1.0.1+1
  gql_link: 1.0.1-alpha+1699832453541
  graphql:
    path: ../lib/graphql
  hive: 2.2.3
  http: 1.1.0
  http_parser: 4.0.2
  in_app_purchase: 3.2.0
  in_app_purchase_android: 0.3.6+1
  intl: 0.19.0
  loading_animation_widget: 1.2.0+4
  logger: 2.3.0
  mobile_scanner: 5.1.1
  normalize: 0.9.0
  package_info_plus: 8.0.0
  path: 1.9.0
  path_provider: 2.1.1
  permission_handler: 11.3.1
  recase: 4.1.0
  restart_app:
    git:
      ref: 2f283fec218256953ede357233599792445b49f1
      url: https://github.com/keonwoopark00/restart_app.git
  roundcheckbox: 2.0.5
  rxdart: 0.27.7
  share_plus: 9.0.0
  shared_preferences: 2.2.3
  shimmer: 3.0.0
  shorebird_code_push: 1.1.3
  sign_in_with_apple: 6.1.0
  sticky_headers: 0.3.0+2
  stop_watch_timer: 3.0.2
  syncfusion_flutter_calendar: 25.2.7
  syncfusion_flutter_charts: 25.2.7
  syncfusion_flutter_core: 25.2.7
  syncfusion_flutter_gauges: 25.2.7
  syncfusion_flutter_pdfviewer: 25.2.7
  syncfusion_flutter_sliders: 25.2.7
  timelines: 0.1.0
  upgrader: 10.3.0
  url_launcher: 6.3.0
  uuid: 4.4.0
  version: 3.0.2
  vrouter: 1.2.1
  watch_it: 1.4.2
  web_socket_channel: 2.4.0
  webview_flutter: 4.8.0

dependency_overrides:
  js: 0.7.1
  move_to_background:
    git:
      ref: a8baf92085a25e1a609e50e2ccabe890ab249c74
      url: https://github.com/keonwoopark00/move_to_background.git
description: ""

dev_dependencies:
  flutter_launcher_icons: 0.13.1
  flutter_lints: 4.0.0
  flutter_test:
    sdk: flutter
  image: 4.1.3
  test: any
  universal_io: 2.2.2

flutter:
  assets:
    - assets/
    - assets/backgrounds/
    - assets/beacon/
    - assets/events/
    - assets/falco/
    - assets/icon/
    - assets/icons/
    - assets/icons/3rd_party/
    - assets/icons/action/
    - assets/icons/diet/
    - assets/icons/health_goals/
    - assets/icons/navigation/
    - assets/icons/recommendations/
    - assets/icons/settings/
    - assets/icons/system/
    - assets/stool_kit/
    - assets/store/
    - assets/survey/
    - assets/onboarding/
    - assets/stool_consistency_types/
    - assets/recommendations/
    - google_fonts/
    - shorebird.yaml
  fonts:
    - family: Poppins
      fonts:
        - asset: google_fonts/Poppins-Thin.ttf
          style: italic
          weight: 100
        - asset: google_fonts/Poppins-ThinItalic.ttf
          weight: 100
        - asset: google_fonts/Poppins-ExtraLight.ttf
          weight: 200
        - asset: google_fonts/Poppins-ExtraLightItalic.ttf
          style: italic
          weight: 200
        - asset: google_fonts/Poppins-Light.ttf
          weight: 300
        - asset: google_fonts/Poppins-LightItalic.ttf
          style: italic
          weight: 300
        - asset: google_fonts/Poppins-Regular.ttf
          weight: 400
        - asset: google_fonts/Poppins-Italic.ttf
          style: italic
          weight: 400
        - asset: google_fonts/Poppins-Medium.ttf
          weight: 500
        - asset: google_fonts/Poppins-MediumItalic.ttf
          style: italic
          weight: 500
        - asset: google_fonts/Poppins-SemiBold.ttf
          weight: 600
        - asset: google_fonts/Poppins-SemiBoldItalic.ttf
          style: italic
          weight: 600
        - asset: google_fonts/Poppins-Bold.ttf
          weight: 700
        - asset: google_fonts/Poppins-BoldItalic.ttf
          style: italic
          weight: 700
        - asset: google_fonts/Poppins-ExtraBold.ttf
          weight: 800
        - asset: google_fonts/Poppins-ExtraBoldItalic.ttf
          style: italic
          weight: 800
        - asset: google_fonts/Poppins-Black.ttf
          weight: 900
        - asset: google_fonts/Poppins-BlackItalic.ttf
          style: italic
          weight: 900
  generate: true
  uses-material-design: true
bryanoltman commented 2 months ago

The app also has "an extension and some native code (non plugin) on our end for some Bluetooth interactions"

bryanoltman commented 2 months ago

I'm unable to reproduce this by creating a new Flutter project with this pubspec, so I believe the issue is not with the dependencies (or at least not solely with the dependencies).

bryanoltman commented 2 months ago

We believe this is due to the release being created with --build-number and --build-name, and the patch targeting that release using --release-version, causing the patch aab to report a different version number than the release aab. This shouldn't matter, but these numbers seem to be finding their way into the classesN.dex files.

bryanoltman commented 2 months ago

Comparing the output of dexdump between a release and a patch build generated in this manner:

bryanoltman@moltman ~/Desktop
⑆ diff release_classes2.dexdump patch_classes2.dexdump
1,2c1,2
< Processing 'release.aab 2/base/dex/classes2.dex'...
< Opened 'release.aab 2/base/dex/classes2.dex', DEX version '037'
---
> Processing 'patch.aab 2/base/dex/classes2.dex'...
> Opened 'patch.aab 2/base/dex/classes2.dex', DEX version '037'
63323c63323
<       value         : 10328
---
>       value         : 1
63328c63328
<       value         : "2024.06.18"
---
>       value         : "0.0.1"