JarResolver error using newest Google Ad Mobs Unity Plugin 3.0.0

9,796 views
Skip to first unread message

Reinaldo Zhang

unread,
Feb 4, 2016, 11:40:59 PM2/4/16
to Google Mobile Ads SDK Developers
Hi all, can somebody help me to resolve this error? I've succeeded building and running my game into an android test device. However, this error keeps showing up although i'm not sure what it is going to affect the game.

Error log:
Google.JarResolver.ResolutionException: Cannot find candidate artifact for com.google.android.gms:play-services-ads:LATEST
  at Google.JarResolver.PlayServicesSupport.DependOn (System.String group, System.String artifact, System.String version) [0x00000] in <filename unknown>:0 

I've read some thread about this artifact error and they suggested to change the dependencies for the svc. Then, i tried to edit the code inside AdMobDependencies.cs inside Editor folder, which says:

svcSupport.DependOn("com.google.android.gms", "play-services-ads", "LATEST");  

I change the LATEST to PluginVersion.PlayServicesVersionConstraint. However, maybe due to incompatibility or lack of library(?), the PluginVersion could not be detected. Hence, no edit is done.

What should I do to get rid of this error? Currently i am using Unity 5.3.2p and Google Ad Mobs Unity Plugin 3.0.0. The SDK has also been updated to the latest version. Any help will be very much appreciated. Thanks!
 

Veer Arjun Busani

unread,
Feb 5, 2016, 11:19:49 AM2/5/16
to Google Mobile Ads SDK Developers
Hi Reinaldo,

The error - Cannot find candidate artifact for com.google.android.gms:play-services-ads simply means that the Google Play Services library was not found in the Unity's Android SDK path. The latest Mobile Ads plugin v3.0 for Unity now comes with JAR resolver, which basically means that you do not have to import any libraries manually in to the Assets folder. While building, the post processor would try to get the required libraries from the local Android SDK. 
  • To fix this, the first thing I want you to look at is Unity -> Preferences -> External Tools -> Android SDK Path. If the path is not set, you can either download it or change it. 
  • Next open the SDK folder, and browse to Tools -> Android.exe. Open this, which would basically open the Android SDK Manager. Here in the Extras sections make sure that you have the following libraries - 
    • Android Support Repository
    • Android Support Library
    • Google Play Services
    • Google Repository
Once you have downloaded the required libraries, the error would no longer be thrown. Do let us know if you need anything more.

Thanks,
Veer Arjun Busani
Mobile Ads SDK Team
Message has been deleted

Reinaldo Zhang

unread,
Feb 14, 2016, 9:58:40 PM2/14/16
to Google Mobile Ads SDK Developers
Hi Veer,

I've done what you suggested. The error did gone! However, i came across another error during an android device build. This time, it says that it failed to repackage resources, resulting in build failure. Previously, i have solved the similar repackage resources error but i have solved it with different error log. 

The error this time is looking complex. 
CommandInvokationFailure: Failed to re-package resources. See the Console for details.
/Users/admin/Downloads/android-sdk-macosx/build-tools/21.1.1/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/admin/Downloads/android-sdk-macosx/platforms/android-23/android.jar" -F bin/resources.ap_ --extra-packages com.google.unity:android.support.v7.appcompat:com.google.android.gms:com.google.android.gms.ads:com.google.android.gms:android.support.v4 -S "/Users/admin/Desktop/src/company/game/Temp/StagingArea/android-libraries/GoogleMobileAdsPlugin/res" -S "/Users/admin/Desktop/src/company/game/Temp/StagingArea/android-libraries/appcompat-v7-23.1.1/res" -S "/Users/admin/Desktop/src/company/game/Temp/StagingArea/android-libraries/google-play-services_lib/res" -S "/Users/admin/Desktop/src/company/game/Temp/StagingArea/android-libraries/play-services-ads-8.4.0/res" -S "/Users/admin/Desktop/src/company/game/Temp/StagingArea/android-libraries/play-services-basement-8.4.0/res" -S "/Users/admin/Desktop/src/company/game/Temp/StagingArea/android-libraries/support-v4-23.1.1/res"

Do you know anything about this? Is this another AdMobs compability error with Android? I am still using the same Unity version 5.3.2p and Google Ad Mobs Unity Plugin 3.0.0. Thank you!

Regards,
Reinaldo

Fran Fernandez

unread,
Feb 15, 2016, 8:54:11 PM2/15/16
to Google Mobile Ads SDK Developers
Im having the same issues. 2 days already trying to fix. 
 
Im using other plugins that dependes on google play services, so the Jar resolver mess it up.  After deleting this plugin version and all the dependences my game can be compiled again.
I recommend you to download an older version of this plugin without jar resolver.

The plugins i use:
Google analytic
One signal
ChartBoost
Unity Notification
Unityads

Arfon Rowe

unread,
Feb 16, 2016, 11:13:53 AM2/16/16
to Google Mobile Ads SDK Developers
This did not work for me

Veer Arjun Busani

unread,
Feb 16, 2016, 12:15:00 PM2/16/16
to Google Mobile Ads SDK Developers
Hi guys,

@Reinaldo
From the log it looks like you are trying to use both Google Play Games and Mobile Ads for Unity. I would suggest you do this - 
  • First make sure that you have the latest versions for both Google Play Games and Mobile Ads plugin v 3.1.0. Then create a new build and import the Google Play Games plugin. 
  • Next go to Window -> Google Play Games -> Downloads -> Google Play Games SDK(Android). Basically this is the Android SDK Manager. Make sure that you have all the required plugins as mentioned above.
  • Then import the Mobile Ads plugin and also copy the demo script from the Hello World app. Make sure that you have copied over your Ad Unit ID's. 
  • Finally after you have created your scene, go ahead a make a build for Android. 
I have attached a video link below on how this is done.

Mobile Ads and Google Play Games implementation video tutorial: Link

@Fran
Would you be able to make a new build as well, from the steps mentioned above, and confirm that the problem still persists.

@Arfon
Please let us know what errors you are seeing. Do get back to us with logs and whether you are trying to use any other plugin that would require Android SDK such as Google Play Games or Google Analytics. Also try to create a new build with the above mentioned steps to see if that solves your problem.

Reinaldo Zhang

unread,
Feb 17, 2016, 12:58:36 AM2/17/16
to Google Mobile Ads SDK Developers
Hi Veer, thanks for the reply. Anyway, my build to Android is successful after i deleted the google-play-game-services lib folder inside my Plugin folder. This time, my game crashed after the Unity splash screen. Upon analysing, i found out that the problem is with the code inside the function requestBanner(). 

I have followed the instruction for basic banner requesting here. That is why i am wondering what went wrong. I am still using Mobile Ads Unity Plugin v3.0.0.

Thanks,
Reinaldo

Reinaldo Zhang

unread,
Feb 17, 2016, 2:27:18 AM2/17/16
to Google Mobile Ads SDK Developers
Edit: It only affects my build to Android devices. For iOS device, the ad smart banner shows itself! Now i wonder if the unit id is the problem?

Veer Arjun Busani

unread,
Feb 17, 2016, 10:04:54 AM2/17/16
to Google Mobile Ads SDK Developers
Hi Reinaldo,

Please try to build a new project from scratch and try to import only Mobile Ads plugin from the steps that I have mentioned. I have also attached a sample project that includes both Mobile Ads and Google Play Games. If you are still unable to load Banners, then you could then try to load using a sample app for Android to see if there is any issue with the Ad Unit ID. 

Project with Mobile Ads and Google Play Game: Link

Reinaldo Zhang

unread,
Feb 25, 2016, 11:52:23 PM2/25/16
to Google Mobile Ads SDK Developers
Hi again Veer. Sorry for the late reply, i am on another project and this time i imported the Google AdMobs Unity Plugin v3.0.1 and then i also have all the required SDK updated to their latest version. Unfortunately, this error shows up when I am trying to build to Android test device. The console log says that:

>CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/admin/Downloads/android-sdk-macosx/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

What is it to do with my sdktools.jar? Do you have any idea how to get rid of this error? Thank you.

Regards,
Reinaldo

Veer Arjun Busani

unread,
Feb 26, 2016, 10:33:31 AM2/26/16
to Google Mobile Ads SDK Developers
Hi Reinaldo,

Two things here - 
  1. Firstly update the JDK environment to 8. Then go into Unity -> Preferences -> External Tools. I want you to check and make sure that the Android SDK and JDK are properly set. From your log the Android SDK seems to be located in your downloads directory. Now this could be an issue when you have multiple plugins depending on Android SDK. For instance the Google Play Games would download the Android SDK for you automatically and place it in the default path (If there's no Android SDK found). Now you have another manually downloaded Android SDK in your downloads folder. It's always cleaner to have one Android SDK set in its default path.
    • One very quick way to solve would be either through the Unity Preferences and manually pointing to the right directory or by downloading the Android Studio, which would configure all the necessary SDK, JDK and NDK to its default path.
  2. Next is to look into Assets -> Plugins -> Android folder and find any duplicate .jar or .aar files anywhere to delete it. You can also remove all of the plugins that you installed and reimport them. This thread would be a good place to look into for further suggestions.
Thanks,

Adnan Nazir

unread,
May 11, 2016, 5:00:48 AM5/11/16
to Google Mobile Ads SDK Developers
Hi!
I am having this error on iOS build of Unity.
Although the JAR resolver is mainly android related. Why I am seeing this error on Unity iOS build?
I am using latest version of plugin. I am on a PC mainly and don't want to install Android SDK on Mac as I only use it to make iOS build.

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
May 11, 2016, 11:43:42 AM5/11/16
to Google Mobile Ads SDK Developers
Hi Adnan,

Would you mind confirming whether you are seeing issues at - 
  • Pre-Build level: This could be due to an issue with your implementation. Make sure that you update the Build Identifier in the Player Settings. Also I would suggest you to -
    • Create a new project as well.
    • Import the Mobile Ads plugin.
    • Add the demo script .
    • Attach it to any Game Object.
    • Add your Ad Unit IDs.
    • Save your scene and add it in to your Build.
    • Right click on the Assets > PlayerServicesResolver and select Google Play Services > Resolve Client JARS.
    • Build and Run.
  • Post-Build level: Once the Unity has generated an iOS build, then open the project (*.xcworkspace) and -
    • Set Enable Modules (C and Objective-C) to Yes in Build Settings.
    • Add $(inherited) to Other Linker Flags in Build Settings.
Do let us know if this fixes the issue. You can also go through our guidelines here.

Thanks,
Veer Busani
Mobile Ads SDK Team
Reply all
Reply to author
Forward
0 new messages