Search Unity

How to reduce the references (and size) from Google Play Games Plugin

Discussion in 'Android' started by woowee, Oct 8, 2018.

  1. woowee

    woowee

    Joined:
    Jul 1, 2017
    Posts:
    10
    Hi there,

    I'm building my game with Google Play Games plugin from github: https://github.com/playgameservices/play-games-plugin-for-unity

    The problem is, when I use Unity's internal Android builder, I got the error "CommandInvokationFailure: Unable to convert classes into dex format." and the stderr says the Play Games plugin alone contributes 30000+ field references! And the plugin also stuffs many extra modules into my app too. Actually the only things I need are auth and leaderboard.

    So, is there any way I can tailor the bulky Play Games plugin down? Of course I may use gradle multi-dex approach to overcome the building error, but I prefer to cut useless things out...
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Yes, you can control which dependencies you need with an xml configuration file that lists the actual google play libraries that you need.

    Note that some of them are the "base" so they're probably always needed, but still you can probably reduce this number considerably.
     
  3. woowee

    woowee

    Joined:
    Jul 1, 2017
    Posts:
    10

    Thanks a lot liortal! Could you please tell me the specific name and path of the configuration xml file? Or, maybe some links with further info. I'm new to unity android development.
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    See the documentation page for Play services resolver: https://github.com/googlesamples/unity-jar-resolver/blob/master/README.md

    Specifically the part about SampleDependencies.xml and how to specify dependencies.

    The Google play games plugin has a file like this probably, so you might be able to edit it.

    Please note, that the plugin probably imports whatever it needs so I am not entirely sure there's something you can do.

    If you need further (paid) help please check out the link in my signature below :)