Update: All of the ad/analytics providers with this issue have been fixed on the RSS feed, so there should not be a need for this again. However, SDKs might slip out of alignment in future, so the guide is left published just in case. If you do have this issue, it is very important you get the latest copy of the provider demo and use it with EA416 or later.
When compiling your game to the Android target, some users have experienced an issue which causes a "Jar Mismatch!" error, something like that shown below:
[dependency] API<=15: Adding annotations.jar to the classpath.
[dependency] Found 2 versions of google-play-services.jar in the dependency list,
[dependency] but not all the versions are identical (check is based on SHA-1 only at this time).
[dependency] All versions of the libraries must be the same at this time.
[dependency] Versions found are:
[dependency] Path: C:\Users\GameMaker\AppData\Local\Temp\gm_ttt_40109\SDKLibs\google_play_services_lib\libs\google-play-services.jar
[dependency] Length: 2764367
[dependency] SHA-1: b6a82434c1eca686607867cd906bcc80ed987837
[dependency] Path: C:\Users\GameMaker\AppData\Local\Temp\gm_ttt_40109\gm_ttt_14087\libs\google-play-services.jar
[dependency] Length: 1501528
[dependency] SHA-1: e5f81129dfb3d02df80126512bc98278ed2bb40a
c:\users\****\android-sdks\tools\ant\build.xml:577: Jar mismatch! Fix your dependencies
In general this is caused by mismatched files in the Google Mobile Ads Extension and can be fixed by following these simple steps:
- Make sure you are on the latest version of GMS, and that your Android SDK is up to date.
- Run the game and take note of the following console messages in GMS
- The red highlighted path will be slightly different to that shown above depending on where you have the temp directory set in the GMS preferences, but it points to the TEMP directory that GMS uses for compiling. The JAR file here is the one we want to use to fix the error.
- Navigate to the given temp directory and copy the google-play-services.jar and the google-play-services.jar.properties file.
- In GameMaker: Studio, right-click on the extension, and select the option "Open In Explorer", then navigate to the GoogleMobileAdsExt/AndroidSource/libs folder.
- Paste the two files that you copied earlier into this folder and then close the explorer and create your APK again.
If all has gone well, you should find that your game compiles perfectly and without further issues.