Closed galloperx closed 6 years ago
Unity Version ? Build Type ? (Internal or Gradle) ?
Unity 2017.4.4f1 and building with Gradle
Trying using internal if gradle is not necessary , i think it is mostly happening due to gradle. See your debugs , is admob initializing or not ? & paste your logcat.
Admob worked before the inclusion of IAP. After that it stopped and throws an exception which I posted above. Internal or Gradle doesn't matter, it's all the same - the result is no banner shown. After searching the web I saw threads like this one: https://forum.unity.com/threads/solved-adding-in-app-unity-service-to-a-game-already-including-admob-causes-error.375354/ Dating back to 2015 the problem is very similar to mine - ads stop working when IAP gets added. Seems like a common problem with Google's library mess, not unique to this plugin.. too bad it's so old and still happens.
@galloperx is the unity-plugin-library.jar
still present in your project under the Assets/Plugins/Android/GoogleMobileAdsPlugin/libs
directory?
Yes it's there, sorry for late reply.
Currently the exact error with showing the banner pops up after this line of code:
bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Top);
and the exception is the class not found: com.google.unity.ads.adlistener
I've tried different ways to solve this, including reinstalling the Android SDK, clearing Gradle cache, updating Java to the latest SDK with changing the java_home to reflect the update (everything works fine there) etc. Most of this is unrelated to the current problem, but I did it anyway just to be sure.
Doing build with internal (instead of Gradle) provides a slightly different error at the same step: Class not found exception: com.google.android.gms.ads.AdSize
Additionally, I tried to use the Resolver's option "Prebuild with Gradle" which led to this error:
Error somewhere in the process of creating the gradle build, executing it, and copying the outputs. This will break dependency resolution and your build will not run. See the output below for possible gradle build errors. The most likely cases are: an invalid bundleID (which you can correct in the Android Player Settings), or a failure to determine the Android SDK platform and build tools verison (you can verify that you have a valid android SDK path in the Unity preferences. If you're not able to diagnose the error, please report a bug at: https://github.com/googlesamples/unity-jar-resolver/issuesA possible work-around is to turn off the "Gradle Prebuild" from the Jar Resolver Settings.
Error (-1):
Traceback (most recent call last):
File "<string>", line 475, in <module>
File "<string>", line 467, in main
File "<string>", line 214, in generate_gradle_build
File "<string>", line 75, in merge_dir_tree
WindowsError: [Error 123] �������������� ������ � ����� �����,: u'https://maven.google.com/*.*'
generate_gradle_prebuild returned -1
UnityEngine.Debug:LogError(Object)
GooglePlayServices.<RunGenGradleScript>c__AnonStoreyE:<>m__11(Result)
GooglePlayServices.ProgressReporter:Update(CommandLineDialog)
GooglePlayServices.CommandLineDialog:Update()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Windows error 123 is the one that says "The filename, directory name, or volume label syntax is incorrect"
@galloperx can you provide a test Unity project that reproduces this issue?
Closing issue due to non-response.
Hello, I was using this plugin and it was working fine (showing one banner) in my app. Without any changes to the banner script code which is almost identical to the example one here, I added IAP through Unity Services, it works fine, but now the banner is gone. While trying to trace the problem to its root I added try {..} catch {...} blocks to the banner creating code and the line bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Top); throws this exception: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.unity.ads.UnityAdListener"
I also ran the Resolver and if I select "Resolve" it says everything's fine, but if I try "Force resolve" resolution fails.
Also note that despite all this the project builds with no errors.