I am using the following plugins in my Unity android game:
1) Admob
2) Google Play Games
3) Unity IAP
I was getting an "Unable to convert classes into dex format" error when I tried to build.
trouble writing output: Too many field references to fit in one dex file: 65681; max is 65536.
I want to reduce the field references, instead of implementing multidex. Could someone explain how to selectively use the Google Play Services packages? In my Assets\Plugins\Android\libs folder I have following files:
play-services-ads-15.0.1.aar
play-services-ads-base-15.0.1.aar
play-services-ads-identifier-15.0.1.aar
play-services-ads-lite-15.0.1.aar
play-services-auth-16.0.0.aar
play-services-auth-api-phone-15.0.1.aar
play-services-auth-base-15.1.0.aar
play-services-base-15.0.1.aar
play-services-basement-15.0.1.aar
play-services-drive-15.0.1.aar
play-services-games-15.0.1.aar
play-services-gass-15.0.1.aar
play-services-tasks-15.0.1.aar
I am implementing Ads, Leaderboard, Achievements and IAP in my game. If there are any .aar packages in the above mentioned list which is not needed for implementing Ads,Leaderboard, Achievements, or IAP , then please let me know, so that I can remove it.
You can try following this guide to make your app a multiplex application which will allow you to bypass that maximum:
https://developer.android.com/studio/build/multidex