0

I cant build my current Unity Android game because of this problem "Too many method references: 76221; max is 65536"

I am using the following SDKs

Facebook (to login and get friends)

GameSparks (backend)

Firebase messaging (for push notifications)

Appodeal (for ads)

After contacting appodeals support they pointed me to a different appodeal sdk package, when I used that one I still couldnt build but the number had gone down from 76221 to 71455.

I am wondering could I cut down the facebook SDK also and maybe get under the 65536 mark.

All I am doing with the facebook SDK is...

Initialising it

Logging in

Getting an access token

Getting url for profile image

Guye Incognito
  • 2,726
  • 6
  • 38
  • 72
  • Why ask thesame question 3 times? – Programmer May 23 '17 at 17:32
  • Did you read the questions. They are not the same!!! – Guye Incognito May 24 '17 at 14:59
  • One is about exporting from unity to android studio. This is about avoiding having to do that by reducing the number of methods in facebooks Unity sdk. Even if the whole export process suceeds its almost pointless as its workflow killing, as one must build to device regularly to test a lot of features in a mobile game – Guye Incognito May 24 '17 at 15:01
  • "This question already has an answer here:" That is completely wrong. SO is so frustrating these days – Guye Incognito May 24 '17 at 15:03
  • Oh really?? Well I now have a workaround for the core problem by doing *exactly* that. These massive sdks are not simply one big file. They are composed of multiple libraries and I was able to remove parts of appodeals SDK that I was not using. Shows what you know. – Guye Incognito May 24 '17 at 15:12

2 Answers2

0

You should succeed in solving your issue by not including the entire packages but only the parts you really need. For example, if all you do on firebase is messaging, include only the core and the messaging:

compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-messaging:10.2.4'
balsick
  • 1,099
  • 1
  • 10
  • 23
0

One solution you may not have explored yet is exporting the project to Android Studio, and then trying to strip stuff. You can also target a higher minSDK (higher than Lollipop, I think). Unfortunately I don't have a more solid concrete "Answer" that will fix this right up, but I can give you a bit more detail about the nature of your problem.

Apps running on the Dalvik runtime get exported into Dalvik Executable (DEX) files. Dalvik specifications only allow 65,536 method references, hence your problem. The new ART runtime has multidex support, which is multiple DEX files.

You can read more here: https://developer.android.com/studio/build/multidex.html

There is a Unity forum post about this. You can read more here: https://forum.unity3d.com/threads/multidex-support-on-android.325429/

Marc
  • 483
  • 1
  • 3
  • 12