Skip to content

Align asset storage with underlying platform #16015

Closed

Description

@szakarias

Moving over @tvolkert's comment from #11019 :

We should be moving towards the goal of storing our assets in the locations that the underlying platform would otherwise store them. e.g. for Android,

res/
    drawable/
    drawable-hdpi/
    drawable-mdpi/
    drawable-xhdpi/
    drawable-xxhdpi/
    drawable-xxxhdpi/

There a suites of tools for packing, optimizing, and so forth an app's final bundle that gets distributed through app stores, and they all assume a certain layout of assets. Our current layout, harking from the days of FLX, doesn't play nicely with these tools. But now that we've gotten ourselves away from FLX, we should have more flexibility here.

e.g. for Android, they're moving towards a model where you don't upload an APK to the Play Store, but rather upload all the constituent parts of your APK, and when a user installs an app, the store cleverly constructs the thinnest APK it can ship to the user, containing only the assets that make sense for that user's device-pixel-ratio, locale, etc.

Activity

  1. lukef commented on Mar 28, 2018

    @lukef
    Contributor

    There is a secondary issue that will need to be addressed. Some assets will be iOS specific and some will be android specific so flutter should provide a mechanism to isolate platform specific assets before copying/migrating to the resource locations. Otherwise, all assets will be available on all platforms for no real reason. There will be an issue if you try to "emulate" iOS on Android and it is missing assets but this could be dealt with by the developer and seems like it is an unlikely end-user scenario anyway.

  2. tvolkert commented on Mar 28, 2018

    @tvolkert
    Contributor

    @szakarias do you think this fits in with the other M3 work, or is it post-M3?

  3. szakarias commented on Apr 5, 2018

    @szakarias
    ContributorAuthor

    Post-M3 as discussed.

  4. added this to the milestone on Apr 5, 2018
  5. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    engineflutter/engine related. See also e: labels.
    on Dec 4, 2018
  6. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  7. removed this from the milestone on Aug 17, 2020
  8. Albert221 commented on May 31, 2021

    @Albert221
    Contributor

    I just wanted to bump this issue. Having Flutter's resolution-aware assets is really nice, but it would really improve on end-user's app size if they would be included for certain pixel densities in AABs.

  9. jonahwilliams commented on Sep 18, 2024

    @jonahwilliams
    Contributor

    We don't plan to do this

  10. Albert221 commented on Sep 18, 2024

    @Albert221
    Contributor

    Just to fully understand here: we can only use resolution-aware assets at the expense of the app size and that's intended and by design? Or does the Flutter team have another idea for how to optimize keeping many resolution-aware assets in asset-heavy apps? Or would we like to have this implemented but the Flutter team doesn't have the capability for this in the foreseeable future?

  11. jonahwilliams commented on Sep 18, 2024

    @jonahwilliams
    Contributor

    Its not possible to change the existing asset system to align with how android resolution aware assets work. A second android specific asset system would need to be written, which we don't plan to do. Instead, we're working on better platform interop so that it is easier to depend on platform specific code/assets

  12. github-actions commented on Oct 2, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  13. locked as resolved and limited conversation to collaborators on Oct 2, 2024
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

    P2Important issues not at the top of the work lista: assetsPackaging, accessing, or using assetsc: proposalA detailed proposal for a change to Flutterengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyplatform-iosiOS applications specificallyteam-engineOwned by Engine teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions