3

I am trying to build on Unity 2019.4.0 but the failed stating that

Cannot fit requested classes in a single dex file (# methods: 68231 > 65536)

The solution for this is to enable multiDex I have done that by following the below steps

Information
external-dependency-manager Version 1.2.156
Jetifier is Enabled
Min API Level 19
Target API Level 28

Custom Gradle Template is enabled and I have added the following in it

Android Manifest Application Tag add the following in the tag
android:name="androidx.multidex.MultiDexApplication"
Enable custom gradle template from Player Settings
then in mainTemplate.gradle add in dependencies
implementation 'com.android.support:multidex:1.0.1'
and in DefaultConfig add
multiDexEnabled true

I have followed the above steps but build fails on same issue which is

Cannot fit requested classes in a single dex file (# methods: 68231 > 65536)

Need help on it, it seems custom gradle file is not working at all. Hope to find a solution here soon.

Jawad Amjad
  • 2,532
  • 2
  • 29
  • 59
  • Don't think its a dupe, but have you seen this q and its answers? https://stackoverflow.com/questions/48249633/errorcannot-fit-requested-classes-in-a-single-dex-file-try-supplying-a-main-dex it seems to suggest multiple ways to enable multidex, one of which might help you? – Remy Jun 19 '20 at 11:55
  • I have tried it all, the same configuration works on previous Unity version but Unity 2019 has some new configurations where there is option for multiple gradle files. So the solution is not working on Unity 2019.4.0 – Jawad Amjad Jun 19 '20 at 12:04

1 Answers1

0

You cannot enable multidex in 2019.4 as before: https://forum.unity.com/threads/cant-build-with-multidex-enabled.773348/