Search Unity

Field references (Internal Build System vs Gradle Exported)

Discussion in 'Editor & General Support' started by UniDro, Jul 27, 2018.

  1. UniDro


    Nov 21, 2014
    Hello forum members and Unity team. I have this concrete question about Android Internal Unity Build System.

    After adding lots of new 3rd party libs I've encountered single dex limit on Android. Ok, no problem. I've exported "development build" version with gradle and built it in Android Studio. Analyzed apk has ~80k references in two dex files. Everything seems to work fine with multiDexEnabled true.

    Then I've made the same for release version. Analyzed apk and surprisingly it has only 44540 references.
    I've removed "multiDexEnabled true" from build.gradle and it still built with no problem. (Again, only for release version)

    Well, I thought, then release can be built directly from Unity.
    However with internal build system I've encountered single dex limit again with this message:
    "trouble writing output: Too many field references to fit in one dex file: 84744; max is 65536."

    Sooo the question appears by itself. Why non-development release build has 44540 methods from Android Studio and 84744 methods from Unity (Internal ADT)? That would be so nice to build directly without AS.

    minifyEnabled set to 'false' for both debug and release.

    Thanks for any info or tips.

    Gradle build works well directly from Unity 2018.2 with
    classpath ''
    Only Internal Build exceeds the method counts limit for single dex. I wonder, what's the difference with Gradle in that area?
    Last edited: Jul 28, 2018
    Zachary625 likes this.