- Home /
Too many method references; max is 65536.
Hi,
After adding yet another fat Android plugin the build got broken:
Error building Player: CommandInvokationFailure:
Unable to convert classes into dex format...
stderr[
trouble writing output: Too many method references: 68573; max is 65536.
I know about Dalvik limitations and have read related topics.
How can I solve the problem?
I need to build the game on continuous integration server, so manual exporting and editing Eclipse project does not suit me.
There are suggestions over the internet to modify ProGuard build step but I haven't succeeded with this optimization.
Probably I should strip large jars somehow, but I don't know how. The most fat are (with size in bytes):
4599100 google-play-services.jar
995624 android-support-v4.jar
925432 everyplay.jar
852733 FlurryAds.jar
687508 vunglePub.jar
552394 facebooksdk.jar
504254 gamecirclesdk.jar
246509 login-with-amazon-sdk.jar
215040 AmazonInsights-android-sdk-2.1.26.jar
147242 unity-ads.jar
Any concrete suggestions would be very much appreciated. Thanks!
Unity 4.6.5p1
Windows 8.1 Pro
Answer by BigToe · Nov 20, 2015 at 06:56 AM
This is really late, but if anyone else is looking this should help.
Google changed their native play-game-services plugin to use AAR files instead of one huge .jar. This reduces the method calls and should allow you to build.
https://github.com/playgameservices/play-games-plugin-for-unity
Answer by Mantiz-GS · Sep 18, 2017 at 10:47 PM
I had the same problem. Try this: If you have aar files exploded (using Play Services Resolver) you can change in each android manifest (is created a folder per plugin) the attribute "package" in tag "manifest" by you main package name (established in player settings), this worked for me. (Mike Flores)
Thanks @$$anonymous$$antiz-GS ! Your suggestion to go through the manifests and unify the package name they are all using worked well for me. I guess for some plugins it doesn't matter what the package name in the manifest is set to?
will changing the package name cuz issues in the functions of the sdks ?what will the package name affect
i'm using heyzap sdk 13.4 with mediation UnityAds, Vungle, Admob,Facebook Audience ,inmobi plus using Facebook sdk V7.9 and unityPurchasing and Firebase Version 4.20 . thats worked for me thanks a lot
Thank you very much @$$anonymous$$antiz-GS,I solved the big problem in your way
Answer by nitaym · Mar 16, 2017 at 08:24 PM
This is quite an old topic, but this was a big problem for me that was solved using this project https://github.com/googlesamples/unity-jar-resolver#usage It's a tool to download only what you need from Google play services.
This worked well for me. I hope this helps someone else
Answer by $$anonymous$$ · Nov 09, 2017 at 11:25 AM
Since in my project I'm using a lot of SDK the solution was to use Gradle on build , a new option unity added in 5.5+ .Gradle job is to reduce the DEX limit and also by this i can enable multi-dexing which also reduces the dex limit , the drawback here is Gradle is quite picky and when it reaches a duplicate files or anything alike it throws an error but everything is fixable.
Your answer
Follow this Question
Related Questions
Unity apk installing 2 icons 2 Answers
android time cheat plugin problem with broadcastreceiver 1 Answer
Web plugin like uWebKit for Android? 0 Answers
CommandInvokationFailure: Unable to convert classes into dex format - Unity 1 Answer
App in background still receive UnityPlayer.UnitySendMessage from Android plugin, normal ? 0 Answers