Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Play Game Service and AdMob ads #801

Closed
shlapkoff opened this issue Nov 13, 2015 · 12 comments
Closed

Google Play Game Service and AdMob ads #801

shlapkoff opened this issue Nov 13, 2015 · 12 comments

Comments

@shlapkoff
Copy link

I use the 0.9.27 version of the plugin.
After the addition of plugin, it removes the directory Assets/Plugins/Android/google-play-services_lib which is necessary for the plugin AdMob. AdMob plugin is not working.

Actions:

  1. Create empty unity project;
  2. Import Appodeal unity3d sdk:
    https://s3-us-west-1.amazonaws.com/appodeal-crossplatform/appodeal-unity/1.13.7_0.5.4/Appodeal.unitypackage
  3. Import Google play game service plugin
@phamdanh
Copy link

I got same problem too

@tonghae
Copy link

tonghae commented Nov 14, 2015

I think my problem is similar. It removes Assets/Plugins/Android/google-play-services_lib if I try to put it back.

@OracleParadiser
Copy link

The same.

Removing Assets/Plugins/Android/google-play-services_lib because the asset does not exist
UnityEditor.AssetDatabase:Refresh()
GooglePlayGames.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:91)
UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[])

But it happened after error:
CommandInvokationFailure: Failed to re-package resources. See the Console for details.
...
AndroidManifest.xml:25: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme').
...

@tonghae
Copy link

tonghae commented Nov 16, 2015

Yeah, same error —
No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme')

@claywilkinson
Copy link

OK - so the plugin is clearly "too smart" for its own good. Short answer - in Assets/GooglePlayGames/Editor/GPGSUpgrader.cs delete lines 81-82. This will stop the repeated deleting of google-play-services-lib. Then add back the directory, then delete the Assets/Plugins/Android/*.aar files - since these duplicate the classes in the entire google-play-services-lib.

This change was made to the games plugin because the google-play-services-lib increases the apk size by 50% since it includes the entire Google SDK, including things like wear, auto, and other APIs that have nothing to do with games.

You can try to do the same for the admob plugin by doing the following:

  1. Don't comment out GPGSUpgrader as described above.
  2. Edit Assets/GooglePlayGames/Editor/BackroundResolution.cs
    2.1 Add the following line at line 67:
    svcSupport.DependOn("com.google.android.gms", "play-services-ads", PluginVersion.PlayServicesVersionConstraint);

This should copy over the ads library.

I have not tried it explicitly, but this should work since it is modeled after how to build an app using AdMob using Android Studio. Please let me know if you try it out!

@tonghae
Copy link

tonghae commented Nov 17, 2015

Thanks! It helped me. Project compiled successfully and the ads are showing normally.
Besides editing BackgroundResolution.cs I commented following line in Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml to make project compile:

activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"

@OracleParadiser
Copy link

No. It doesn't help...
Commenting 81-82 lines prevents deleting. But project isn't compiling. Cannot merge manifest related to aar file. (cannot merge Activity)...
I cannot delete aar files. They are recovering. I deselected them in inspector. After this project compiled but goggle servises was absent in game...

The second approach also did't help.

@ToprakOzgur
Copy link

same problem here.

@gabiruiz91
Copy link

I did the same of tonghae and it worked!

@claywilkinson
Copy link

Also check #814 - which documents the success of using these two together.

@PhannGor
Copy link

I would prefer do not touch GPGS package. Just don't import google-play-services_lib and android-support-v4.jar from the Appodeal SDK package. Instead copy play-services-ads-8.4.0.aar from
android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads/8.4.0 to /Plugins/Android.

Also use /Plugins/Android/MainLibProj/AndroidManifest.xml instead of /Plugins/Android/AndroidManifest.xml to add permissions, activities and metadata required for Appodeal SDK.

This approach works for me at least for Unity 5.3.1 and Appodeal SDK 1.13.10.

@claywilkinson
Copy link

The admob plugin has been updated to 3.0.0 and now is compatible with the Play Game Services plugin.
https://github.com/googleads/googleads-mobile-unity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants