0

I created a web-only plugin with some web specific resources, about 40MB. In the past, these resources were not packaged when 'flutter build apk' was run, but now these resources appear in APK. How can I avoid them?

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 11.6 20G165 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] Connected device (1 available)
dependencies:
  flutter:
    sdk: flutter
  eaken_flutter_plugin_web:
    path: ../eaken_flutter_plugin_web
plugin:
    platforms:
      android:
        package: com.eaken.eaken_flutter_plugin
        pluginClass: EakenFlutterPlugin
      ios:
        pluginClass: EakenFlutterPlugin
      web:
        default_package: eaken_flutter_plugin_web

eaken_flutter_plugin_web is my web-only plugin,I wish its assets will not appear in APK. Here is its assets:

  assets:
    - assets/js/database.js
    - assets/js/sql-wasm.wasm
    - assets/js/sql-wasm.js
    - assets/js/canvaskit.wasm
    - assets/js/canvaskit.js

  fonts:
    - family: 'Roboto'
      fonts:
        - asset: assets/fonts/Roboto-Regular.ttf
    - family: 'Noto'
      fonts:
        - asset: assets/fonts/NotoSansSC-Black.otf
        - asset: assets/fonts/NotoSansSC-Bold.otf
        - asset: assets/fonts/NotoSansSC-Light.otf
        - asset: assets/fonts/NotoSansSC-Medium.otf
        - asset: assets/fonts/NotoSansSC-Regular.otf
          style: normal
        - asset: assets/fonts/NotoSansSC-Thin.otf
Eaken
  • 1
  • https://stackoverflow.com/questions/49064969/flutter-apps-are-too-big-in-size ==> read carefully your answer will be there im sure – Awais Rehman Jan 18 '22 at 07:10
  • I'm sorry it doesn't have my answer.My question is why in the past, when running "flutter build APK", the assets of web-only plugin were not packaged in APK, but now they are packaged in APK.If I just want to reduce the APK, I can directly remove the dependency of the web-only plugin. – Eaken Jan 18 '22 at 08:12

0 Answers0