• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by Qbit86 · May 20, 2015 at 11:09 AM · androidandroid buildpluginplugins

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

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image

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

Comment
nitaym
Bunny83
SweatyChair
nt314p

People who like this

4 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

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

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

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)

Comment
alirezakhaan

People who like this

1 Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mpaxman · Oct 06, 2017 at 09:59 PM 0
Share

Thanks @Mantiz-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?

avatar image $$anonymous$$ · Oct 11, 2017 at 04:30 PM 0
Share

will changing the package name cuz issues in the functions of the sdks ?what will the package name affect

avatar image alirezakhaan · Oct 18, 2017 at 05:59 AM 0
Share

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

avatar image mtlyy · Dec 12, 2018 at 11:15 AM 0
Share

Thank you very much @Mantiz-GS,I solved the big problem in your way

avatar image

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.

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to use android Renderscript v8 with Unity? 0 Answers

Android Activity equal in ios 0 Answers

Using AndroidJavaClass in a java Unity3d plugin 0 Answers

Android app may work in BG with Plugin? 1 Answer

Android plugin dependency 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges