Skip to content

Support creation of an engine AAR instead of a JAR for Android. #22102

Open

Description

@matthew-carroll

Support creation of an AAR instead of a JAR for Android.

Android uses XML resources as a canonical element of everyday development. It is possible to reference FlutterFragment and FlutterView from XML, but the Flutter embedding currently has no capability to expose XML attributes to customize those elements.

For example, we might want to do this:

<io.flutter.embedding.FlutterView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:splash="@android:color/blue"
    />

The definition of app:splash needs to be setup as an XML resource. But we can't do this in the embedding because we aren't producing AARs and therefore we cannot include any resources.

The JAR restriction also prevents us from defining any of our own XML layouts, defining our own colors, defining any Flutter-specific IDs, etc.

Activity

  1. dnfield commented on Oct 16, 2018

    @dnfield
    Contributor

    I'm not actively working on this, removing assignment - please let me know if you're looking for anything from me on it though!

  2. removed their assignment
    on Oct 16, 2018
  3. added
    engineflutter/engine related. See also e: labels.
    on Dec 11, 2018
  4. matthew-carroll commented on Jun 6, 2019

    @matthew-carroll
    ContributorAuthor

    @blasten I wanted to put this ticket on your radar. It's been here for a while. I think this is something you plan to work on at some point, right? There are many reasons why we'd like to generally support the production of AARs. There may be duplicate tickets based on other reasons.

  5. blasten commented on Jun 6, 2019

    @blasten

    @matthew-carroll Let's chat about this. I need to figure out the priority.

  6. blasten commented on Jun 6, 2019

    @blasten
  7. dnfield commented on Jun 6, 2019

    @dnfield
    Contributor

    AFAICT, the following changes would be needed:

    • Rename flutter_java.jar to classes.jar in the engine build scripts (Trivial)
    • Change create_flutter_jar.py to actually create an aar (Seems trivial)
    • Update the tooling to look for the .aar instead of the .jar (Seems non-trivial - requires updates to templates, tooling code, gradle code)

    It would probably be helpful for someone to manually do this (manually compose an .aar from the existing .jar) and make sure the benefits we think we'll get from it actually pan out.

  8. matthew-carroll commented on Jun 6, 2019

    @matthew-carroll
    ContributorAuthor

    @dnfield also, the reason I identified this need way back last year was specifically because I wanted to include Android resources. So in addition to the technical build steps, we need a location for those resources: styles, IDs, colors, etc. We are currently encoding random integers as IDs, for example.

  9. removed their assignment
    on Jun 11, 2019
  10. 3 remaining items

  11. xster commented on Dec 19, 2019

    @xster
    Member

    This bug is about us building the engine into an AAR on LUCI rather than users building their modules into an AAR via Flutter tools

  12. jmagman commented on Dec 19, 2019

    @jmagman
    Member

    This bug is about us building the engine into an AAR on LUCI rather than users building their modules into an AAR via Flutter tools

    Ah, thanks.

  13. dnfield commented on Feb 6, 2020

    @dnfield
    Contributor

    Would this be needed to support delivering assets from the engine as configuration APKs?

    In particular, if we could manage to split ICU up into various locales, could we ship them as configuration APKs that are loaded only by users who need them?

    /cc @blasten

    https://developer.android.com/guide/app-bundle/dynamic-delivery

  14. xster commented on Mar 12, 2020

    @xster
    Member

    I suspect this is orthogonal to dynamic delivery from what I can think of. This is mostly about compile time dependencies such as downstream consumers can reference the engine and make compile time assumptions about what resources are available. Once we actually build and bundle runtimes with an APK, we can make that APK do anything including use dynamic delivery to load more APK contents.

  15. matthew-carroll commented on Mar 12, 2020

    @matthew-carroll
    ContributorAuthor

    I think this was also about the ability to reference resources, like IDs from within the embedding. Currently, I think we generate some random numbers in places where the correct answer is R.id.something. But that ID system only exists when building AARs.

  16. removed their assignment
    on May 1, 2020
  17. added
    P2Important issues not at the top of the work list
    on Dec 9, 2020
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: existing-appsIntegration with existing apps via the add-to-app flowe: embedderUsers of the Embedder APIengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions