Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug APK size increased in android studio

Discussion in 'Editor & General Support' started by Ashwathama9045, Mar 30, 2023.

  1. Ashwathama9045

    Ashwathama9045

    Joined:
    Mar 30, 2023
    Posts:
    4
    Hello,

    In my project I have used addressable which is around 53 MB and I'm splitting binary as well because there are some vuforia assets in the streaming assets folder. So the OBB file size is 52 MB which is I'm downloading from the server. I need to integrate it with android native project so I'm exporting android project.

    When I create build from unity then size of the build is 42 MB where as when I export the android project and build it, size becomes 94 MB. I have used app analyzed in the android studio. In that raw file size is showing different but download size is almost same. I'm attaching screenshots of comparison.
    What will the workaround for it?

    Unity Build :

    Unity Build.png

    Android Studio Build :

    Android Studio Build.png

    Comparison :

    Comparison.png
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,504
    Maybe configuration issue?
    Are you using Release from Unity? I believe Android Studio defaults to debug build, you have to specifically ask to build a release.
     
  3. Ashwathama9045

    Ashwathama9045

    Joined:
    Mar 30, 2023
    Posts:
    4
    I haven't used release from unity. I'm building debug from android studio
    Do I need to set anything in unity while creating android export?
     
    Last edited: Mar 30, 2023
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,504
    When you consider size of your app, you should be using Release build from Unity, regardless of whether you build directly from Unity, or export.
    In Android Studio use Build->Select Build Variant
     
  5. Ashwathama9045

    Ashwathama9045

    Joined:
    Mar 30, 2023
    Posts:
    4
    I tried that
    There is no change in the raw file size
    It's same, release build size in unity 42 MB where as release build size in android studio 94 MB
     
  6. Ashwathama9045

    Ashwathama9045

    Joined:
    Mar 30, 2023
    Posts:
    4

    I figured it out
    android:extractNativeLibs="true" this line wasn't added in manifest file after exporting android project. It reduced the size to 42 MB in android studio build