When deploying your Unity game to an Android device you might see the error: Unable to load dll 'gpg'. In this post I will show you how solve this issue.
Unity Android: Unable to load dll ‘gpg’
To solve this issue you need to open you game in Unity. From the menu bar select Windows -> Google Play Games -> Setup and copy the XML to your clipboard or whatever location to store it for later use. Make a note of the contents of the other two fields as well.
Next, locate the two folders called GooglePlayGames and PlayServicesResolver. You can delete those two folders.
Then, browse to the github site where you can download the Google Play Games SDK: https://github.com/playgameservices/play-games-plugin-for-unity
And click on the Clone or download button. Choose to download the zip file. After downloading unpack (double click) the zip file to see its contents.
Select the folder ‘Current build’.
Now, drag this package into your Unity project window to import it. Make sure you have deleted the folders as mentioned above before! Select Import all button in the dialog and after that what a minute to let the import and installation complete. It will show you one popup telling you that the installation has succeeded. Click OK and still wait for a minute to let compilation and setup complete. You will see another popup asking if you would like to enable auto resolution. If you choose Yes it will resolve and download Android dependencies. I always choose Yes. Now, it might be that a number of popups follow telling you that there are android plugin conflicts. It basically means that your auto resolver has found outdated Android plugins. Choose the option to automatically resolve the conflicts.
Next, run setup again by going to Window -> Google Play Games -> Setup. Check to see if the xml (resources definition) is still there. If not, use the one we have stored at the clipboard.
Finally, if you are using other Google Play Games plugins like the Turn Based Multiplayer you need to repeat the same download from Github, unpack, import steps as described above. The download link for the Google Play Games Turn Based Multiplayer plugin is: https://github.com/playgameservices/play-games-plugin-for-unity
That is it! Build and run your game on an actual Android device or simulator and you should be fine. If not, try to run the Android setup from the last step again.
Pro tip: did you fix the dll issue but still it doesn’t work? Try to reset Google Play Services on your device. It is easy and safe. Go to your devices settings. Select Apps and find Google Play Services app (not the Google Play Games). Select it. Find the Memory item and select it. Now choose the button to clear the memory and caches. After that, every games where you are using Google Play for authentication etcetera, will authenticate again. Try it and you will discover that when you start your Game you will see the Google Play popup, authentication (and possibly you need to select which Google Play account if you have several) and login.