Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Dynamic Feature Modules - Is there a unity implementaion I am missing?

Discussion in 'Android' started by ArielVardy, Nov 14, 2019.

  1. ArielVardy

    ArielVardy

    Joined:
    Jun 19, 2017
    Posts:
    2
    Hi,

    https://blogs.unity3d.com/2018/10/03/support-for-android-app-bundle-aab-in-unity-2018-3-beta/

    Aside from this post, I cannot find any indication of how dynamic feature modules are supported in Unity. When I build I just get a large aab file, that when I unpack I see it does not split in any way (tried marking some assets to belong to AssetBundles, but I think now it only applies for either the unity ones or OBB which is not supported with aab).

    Can anyone link me to a resource, or even a post by someone with experience on the matter?

    Thanks,
     
  2. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    I'm going to bump this up as I am also looking for more information on how to use Android App Bundles with Unity. Apart from that one blog post I can't seem to find much consistent information or guides on how to set this up properly in Unity.
     
  3. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    580
    Hello, that old blog post states
    In latest Unity versions this is still the case, no additional splitting options are supported. So APK files generated from the AAB are split only by architecture. Everything else is included in all APK variants.
     
  4. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    So in regards to this section of the blog...
    Would it be true that we can not currently use Dynamic Features?

    Additionally, in the linked Android documentation it states the following
    Do we have control over that or is Unity somehow taking care of that when we build our Android projects?
     
  5. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    580
    Yes, Dynamic Features are not supported for now.
    The resources mentioned in the linked page are the ones normally used by java applications. Unity does not use them. We only specify launcher icons and static splash screen image (if it is enabled).
     
  6. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    Okay. I am admittedly a bit confused as to what the advantages of using AAB is then.

    The blog states the following
    Does Google Play just generate several APKs for each possible configuration of Android? That seems... kind of crazy. It then proceeds to state.
    If Configuration APKs and Dynamic Delivery are not supported for now, how would Google know to generate several APKs?

    I feel like I am missing a key component of this to understand the benefits of using AAB over something like Split Binary or just an APK.
     
    Last edited: Nov 20, 2019
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,890
    There are no practical benefits currently.

    Google will stop nagging you to use .aab.

    And the resulting APKs May be ever so slightly smaller (maybe?)?
     
  8. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    580
    The AAB is a great improvement for android apps which use standard drawable resources, and other resources which are used by a java activity. It does not really benefit applications which do rendering in the native code (such as Unity). From the Unity perspective multiple APK files split by architecture is essentially the same as AAB. Split Binary is different, because using that the code for all architectures will end up on the device, regardless of the architecture of the phone.
     
  9. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    So currently, from what I understand these are our options. As an FYI, I am using 2019.1.12f1 as reference. Correct me if I've misunderstood anything.

    In Player Settings.
    Split Binary Application

    • Results in an OBB file and an APK file
    • This also results in the code for all architectures being present on the device regardless of whether that architecture is matched by the device itself
    Split APKs by Target Architecture (Experimental)
    • Target archs would be set to ARMv7 and ARM64 as x86 is now deprecated
    • This would result in two APKs where ARMv7 architecture code is in one and vice versa for the other
    In Build Settings.
    Build App Bundle (Google Play)

    • Checking this will result in a bundle file to be uploaded to Google Play Console where Google generates what I would assume is two APKs for the selected architectures in your Player Settings (ARMv7 and ARM64)
    • These APKs may be smaller than the APKs generated by Unity in the option above
    As a follow up question, can Split APK by Target Archiecture and Split Binary Application be used together? I haven't actually tried this. Would this results in two APK's with a single OBB file that is uploaded with both to the Google Play Console?
     
  10. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    580
    You are correct regarding the build options. Well, there is also an option to export gradle project, but that does not add additional options for splitting the build out of the box.
    Yes, they can be used together and yes, you would get two APK files with a single OBB file. When uploading your APK files you would have to upload the same OBB file twice, so each APK would have OBB file assigned to it (Play Store will complain that the OBB file has already been uploaded, but you will have to do it anyway).
     
  11. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    This has been very informative @JuliusM. Thank you for the prompt replies and I'm sure this will likely turn up in some Google search results.

    Would you be able to expand on what the timeline is potentially looking like for AAB to be fully implemented in Unity?
     
  12. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    580
    As I've mentioned before, AAB is mostly useful for apps that use standard resources described here https://developer.android.com/guide/topics/resources/providing-resources. Unity does not use them, so it is not very useful for us. Currently there are no plans to do anything else regarding the AAB.
    If you are interested in a dynamic delivery concept, check out the asset bundles https://docs.unity3d.com/Manual/AssetBundlesIntro.html which work on multiple platforms supported by Unity.
     
  13. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    Thank you. I am actually already using the Asset Bundles system in several of our projects already. The initial blog post give off a vibe like there was more coming but it seems like the only advantage is deferring APK generation and signing to Google for the two architectures as opposed to using Unity to do that. And also potentially smaller build sizes.

    Also I just realized, by using an AAB and Google generating the APK, does that mean it would not generate an OBB and would instead attempt to package everything into the APK?
     
  14. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    580
    Yes, that is correct.
     
  15. GaZnoDrone

    GaZnoDrone

    Joined:
    Mar 3, 2015
    Posts:
    28
    Is there a way to make an exported Gradle project using 2019.3.11b dynamic module compatible?. AAB file made by unity itself doesn't support Dynamic Module currently as this thread clearly mentions that.
    https://stackoverflow.com/questions/52059339/difference-between-apk-apk-and-app-bundle-aab
    the thread above briefly explains
    Will the asset bundle method you mentioned work with exported Gradle projects. We are trying to integrate unity library into a native android app, we were hoping to achieve a dynamic module feature so as to have multiple unity projects library in the base native app and the users could download any of the games in the base app from the play store.
    The AAB file will be generated from Android Studio instead of unity itself.

    Could we do something about it?. There are conflicts that occur when more than 1 unity libraries are imported into the base app, a conflict occurs stating there are same paths in both libraries unityLibrary\src\main\assets\bin\Data\Managed\Metadata\global-metadata.dat
    We have been following this: https://forum.unity.com/threads/int...brary-in-native-android-app-version-2.751712/

    Is it possible to achieve this using unity projects?
    Is there a way to achieve this?
    Any help or information is appreciated. Thank you.
     
    Last edited: Nov 25, 2019
unityunity