Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Asset Bundles in StreamingAssets directory can load slower when building the Android App Bundle

Discussion in 'Android' started by JuliusM, Jul 17, 2019.

  1. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    518
    This is a known issue which can be tracked here: https://issuetracker.unity3d.com/is...more-time-when-the-project-is-built-as-an-aab

    The problem is that when the apk is created from the app bundle file, asset bundles can get compressed even though they shouldn't be. The behavior depends on many factors: gradle plugin version, where the asset bundles are placed and in case the apk is created locally instead of the PlayStore, then behavior also depends on the host OS and the bundletool version.

    The easiest way to avoid this issue is to place asset bundles directly in the StreamingAssets directory. This way the bundles will not be compressed.

    If the asset bundles are placed in a subdirectory of the StreamingAssets directory, then they could get compressed depending on the previously mentioned factors.
    If you must place the asset bundles in a subdirectory, try to use the latest gradle plugin version that is compatible with your Unity version (different Unity versions are compatible with different gradle plugin versions, you can see the compatibility here https://forum.unity.com/threads/gra...current-version-is-4-0-1.499520/#post-3500005 ) and also ignore the asset bundle performance from the local builds, instead upload the app bundle to the GooglePlay and download the apk from there.

    We are working on a solution to this issue, but for now it is best to use the previously mentioned workaround.
     
  2. Unity_User_2

    Unity_User_2

    Joined:
    Aug 23, 2017
    Posts:
    2
  3. zyc_dc

    zyc_dc

    Joined:
    May 11, 2018
    Posts:
    42
    My understanding is if I use Gradle Installed with Unity and download the apk from GooglePlay. There will be no problem, right?
     
  4. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    518
    The problem is caused by building the AAB. If you are uploading AAB to Google Play store, then you can run into this issue. If you are uploading APK, then this issue will not happen.
     
  5. zyc_dc

    zyc_dc

    Joined:
    May 11, 2018
    Posts:
    42
    So, if I use AAB, there's still a chance that I will run into the issue even I use the latest Gradle and upload the app bundle to the GooglePlay and download the apk from there? Another thing confusing me is that I can find the issue got listed in Known Issues in 2019.3.x release notes, but I never saw it in 2019.2.x release notes. The ticket in issue tracker shows that the issue exists in all 2019 versions.
     
  6. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    518
    yes.
    The information in the issue tracker is correct. The issue exists in all 2019 versions.
     
  7. SunLin_L

    SunLin_L

    Joined:
    Mar 14, 2016
    Posts:
    1
    Hi,I build an aab though unity gradle project,and I can't load assetbundle from the split apk.I try to modify the streamingassets path,like "jar:file:///data/app/com.XXX.AppBundleTest-MD4GKFGbdvh7C8Ge3CXjKA==/split_asset1.apk!/assets/Assets/Resources/canvas",but not work,it shows " Unable to open archive file",so can you tall me how to load assets from split apk? Thanks
     
  8. ElliotCurtis

    ElliotCurtis

    Joined:
    Nov 26, 2018
    Posts:
    16
    So, I've had to rebuild a project because my PC died. Everything works fine but when I build it, the gamedata does not make it into the build.
    In previous versions, the apk created a folder called "spreadsheets" in the "data" folder of the game on the 'phone.
    Now when I create a build, the spreadsheets are not included and the game does not work.
    Does that make sense to anyone?
    Thanks
     
unityunity