Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
3
Question by BabyRuman · Oct 25, 2014 at 01:23 AM · androidandroid build

Too many method references when I export android build

When I export android build, I got some errors below

stderr[

trouble writing output: Too many method references: 74004; max is 65536. You may try using --multi-dex option. References by package: ...

how do I use '--multi-dex option' ?

or

how to set on project.properties files in Unity side? I know dex force jumbo flags can help. but I cant find it in Unity.

how do I avoid this situation?

Yes. I use many kinds of sdks. but I needs those.

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by liortal · Oct 26, 2014 at 07:43 AM

This excellent post describes why this error happens in the first place: https://medium.com/@rotxed/dex-skys-the-limit-no-65k-methods-is-28e6cb40cf71

Unity is "hard-wired" to run the dex tool with a certain set of arguments. You cannot modify that unfortunately.

What you could do is output a code project ("Google Android Project") and then build it from the command line using the appropriate options.

Another solution would be to limit the number of method references your game has to avoid this issue in the first place. This can be done in a number of different ways:

  1. Remove unused native Android plugins from your project.

  2. Use Gradle + ProGuard to strip any unused / unreferenced code automatically.

  3. Use Gradle + Multidex to create multiple dex files, overcoming the reference count limit (although his is not recommended, which is why I listed it as the last option).

Comment
Add comment · Show 7 · 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 realworld666 · Dec 18, 2014 at 12:17 PM 0
Share

I can't export a project either because of the dex issue.

avatar image liortal · Dec 18, 2014 at 12:20 PM 0
Share

can't you also export a "Google Android Project" ?

avatar image realworld666 · Feb 04, 2015 at 10:48 AM 0
Share

no. I have the same issue. The method limit is being reached because of third party libraries such as the Google Games plugin rather than the game itself. We can't not use the API's so there needs to be a solution for this!

avatar image turdann · Apr 28, 2015 at 06:31 AM 0
Share

I have the same problem... did you find a solution? Thanks!

avatar image liortal · Apr 28, 2015 at 06:09 PM 0
Share

I cannot think of any solution other than reducing the number of methods/code that you're adding in via 3rd party libraries, or if that's not possible, run some sort of code stripping tool (e.g: ProGuard)

Show more comments
avatar image
0

Answer by wpdev · May 01, 2015 at 04:09 AM

This usually happens when google google-play-services.jar included, and this is really large library. Couple of month ago google separated this lib on submodules and you can try to include only required. If this not solved the issue, then you have to export google project from unity and build apk on your own. If you have any errors that dont allow you to export project then simply remove some jars from plugin folder and export, after add them back in android studio through graddle. Now its possible to enable multidex support for android 4.0.+. However if you need to support android 2.3.+ then its very tricky. You will need to limit dex file size(file can be found inside apk) to about 5mb each to allow every low performance device to load it. Why? Because enabled multidex option cuts on 10mb dex files and this apk wont install on some 2.3 devices

Comment
Add comment · 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
0

Answer by $$anonymous$$ · Aug 08, 2017 at 06:26 PM

Check this post over at StackOverflow to learn how to enable multidex in Unity.

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

graphic issue with some android devices running 6.0 0 Answers

MissingMethodException: get_vuforiaEnabled() 3 Answers

How to automate export of android project through command line, which is done by following menu item on UI: "File -> Build Settings -> Export" (shown in attached image) 1 Answer

WWW.audioClip not playing on android build 1 Answer

Unable to merge Android Manifests 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