Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Admob Unity Package that work with Unity 3.2 above

Discussion in 'Android' started by MicroEyes, Mar 8, 2013.

?

Are you Satisfy with this Plugin Tutorial

  1. Yes

    66.9%
  2. No

    8.0%
  3. Not Completely

    25.1%
  1. mntcarp

    mntcarp

    Joined:
    Dec 12, 2011
    Posts:
    25
    Hi all,
    I get this error in the CatLog:

    All I did was add an empty object in the scene with this script:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using com.microeyes.admob;
    4.  
    5.  
    6. public class AdManager: MonoBehavior
    7. {
    8. void Start()
    9. {
    10. Invoke("DisplayBannerAds", 1f);
    11. }
    12.  
    13. public void DisplayBannerAds ()
    14.         {
    15.                 BannerAd bannerAd = AdmobManager.Get<BannerAd> ("MenuAd");
    16.                 bannerAd.BannerType = EBannerAdType.SMART_BANNER;
    17.                 bannerAd.Orientation = EOrientation.HORIZONTAL;
    18.                 bannerAd.AnimInType = EAnimationInType.FADE_IN;
    19.                 bannerAd.AnimOutType = EAnimationOutType.SLIDE_OUT_RIGHT;
    20.                 bannerAd.SetPosition (EPosition.CENTER_HORIZONTAL, EPosition.BOTTOM);
    21.  
    22.                 bannerAd.Create ();
    23.  
    24.                 AdmobManager.Load ("MenuAd");
    25.  
    26.                 AdmobManager.ShowBanner ("MenuAd");
    27.         }
    28. }
    Also, when I test it in BlueStacks, the game crashes after 1 second. In my device nothing happens though.
    What could it be?
    Many thanks in advance!
     
  2. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    Hi Microeyes!
    Trying to add interstitial AD, and unity back this error :
    error CS0103: The name `l_interAd' does not exist in the current context
    Here is a code:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4. using com.microeyes.admob;
    5.  
    6. public class LevelsPlayerController : MonoBehaviour {
    7.  
    8.     void Start () {
    9.     / prepare and load ad
    10.         InterstitialAd l_interAd = AdmobManager.Prepare<InterstitialAd>("Interstitial_1");
    11.          
    12.         l_interAd.Load();
    13.  
    14.  
    15. }
    16. void Update() {
    17.  
    18.             public void RetryLevel(){
    19.  
    20.         /show
    21.         l_interAd = AdmobManager.Get<InterstitialAd>("Interstitial_1");
    22.         l_interAd.Show();
    23. }
    24. }
    25.  
    26.  
    27. }
    28.  
    29.  
     
    Last edited: Dec 3, 2014
  3. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    Somebody, please help!
     
  4. jerryberry

    jerryberry

    Joined:
    Feb 12, 2014
    Posts:
    6
    I can help you ;) You declared l_interAd in function Start, so it's not accessible in Update.

    I would do something like this:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4. using com.microeyes.admob;
    5. public class LevelsPlayerController : MonoBehaviour {
    6.  
    7.  
    8.     void Start () {
    9.     // prepare and load ad
    10.         InterstitialAd l_interAd = AdmobManager.Prepare<InterstitialAd>("Interstitial_1");
    11.         l_interAd.Create();
    12.         AdmobManager.Load("Interstitial_1");
    13. }
    14. void Update() {
    15.            //Here, in UI or somewhere else you can call RetryLevel();
    16. }
    17. void RetryLevel() {
    18.     AdmobManager.ShowInterstitial("Interstitial_1");
    19. }
    20. }

    And here's my problem:
    When I try to buil an APK I get this error in console:

    I tried changing targetSdkVersion in every manifest, in (I think) every combination.

    Also, I have this line in my manifest (it was set to true by default):
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    What should I do, MicroEyes?
     
  5. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    Thank you, I would try.

    How to install this plugin with Google Play Services plagin? Ive got lot of errors when try to build

    Code (CSharp):
    1. Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
    2. D:\AndroidSDK\build-tools\20.0.0\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "D:/AndroidSDK/platforms/android-21\android.jar" -F bin/resources.ap_ --extra-packages com.google.example.games.basegameutils:com.google.android.gms:com.google.example.games.mainlibproj -S "E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\BaseGameUtils\res" -S "E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res"
    3.  
    4. stderr[
    5. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\ads_attrs.xml:10: error: Attribute "adSize" has already been defined
    6. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\ads_attrs.xml:17: error: Attribute "adSizes" has already been defined
    7. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\ads_attrs.xml:20: error: Attribute "adUnitId" has already been defined
    8. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:4: error: Resource entry common_signin_btn_dark_text_default is already defined.
    9. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:4: Originally defined here.
    10. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:5: error: Resource entry common_signin_btn_dark_text_pressed is already defined.
    11. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:5: Originally defined here.
    12. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:6: error: Resource entry common_signin_btn_dark_text_disabled is already defined.
    13. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:6: Originally defined here.
    14. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:7: error: Resource entry common_signin_btn_dark_text_focused is already defined.
    15. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:7: Originally defined here.
    16. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:8: error: Resource entry common_signin_btn_light_text_default is already defined.
    17. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:8: Originally defined here.
    18. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:9: error: Resource entry common_signin_btn_light_text_pressed is already defined.
    19. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:9: Originally defined here.
    20. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:10: error: Resource entry common_signin_btn_light_text_disabled is already defined.
    21. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:10: Originally defined here.
    22. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:11: error: Resource entry common_signin_btn_light_text_focused is already defined.
    23. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:11: Originally defined here.
    24. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:12: error: Resource entry common_signin_btn_default_background is already defined.
    25. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:12: Originally defined here.
    26. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_colors.xml:13: error: Resource entry common_action_bar_splitter is already defined.
    27. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\colors.xml:13: Originally defined here.
    28. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:6: error: Resource entry common_google_play_services_install_title is already defined.
    29. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:21: Originally defined here.
    30. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:10: error: Resource entry common_google_play_services_install_text_phone is already defined.
    31. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:25: Originally defined here.
    32. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:14: error: Resource entry common_google_play_services_install_text_tablet is already defined.
    33. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:29: Originally defined here.
    34. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:17: error: Resource entry common_google_play_services_install_button is already defined.
    35. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:32: Originally defined here.
    36. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:21: error: Resource entry common_google_play_services_enable_title is already defined.
    37. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:36: Originally defined here.
    38. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:25: error: Resource entry common_google_play_services_enable_text is already defined.
    39. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:40: Originally defined here.
    40. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:30: error: Resource entry common_google_play_services_enable_button is already defined.
    41. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:45: Originally defined here.
    42. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:34: error: Resource entry common_google_play_services_update_title is already defined.
    43. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:49: Originally defined here.
    44. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:38: error: Resource entry common_google_play_services_update_text is already defined.
    45. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:53: Originally defined here.
    46. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:41: error: Resource entry common_google_play_services_network_error_title is already defined.
    47. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:56: Originally defined here.
    48. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:44: error: Resource entry common_google_play_services_network_error_text is already defined.
    49. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:59: Originally defined here.
    50. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:47: error: Resource entry common_google_play_services_invalid_account_title is already defined.
    51. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:62: Originally defined here.
    52. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:50: error: Resource entry common_google_play_services_invalid_account_text is already defined.
    53. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:65: Originally defined here.
    54. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:54: error: Resource entry common_google_play_services_unknown_issue is already defined.
    55. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:69: Originally defined here.
    56. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:57: error: Resource entry common_google_play_services_unsupported_title is already defined.
    57. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:72: Originally defined here.
    58. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:60: error: Resource entry common_google_play_services_unsupported_text is already defined.
    59. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:75: Originally defined here.
    60. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:64: error: Resource entry common_google_play_services_unsupported_date_text is already defined.
    61. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:79: Originally defined here.
    62. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:67: error: Resource entry common_google_play_services_update_button is already defined.
    63. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:82: Originally defined here.
    64. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:70: error: Resource entry common_signin_button_text is already defined.
    65. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:85: Originally defined here.
    66. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\strings.xml:73: error: Resource entry common_signin_button_text_long is already defined.
    67. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values\common_strings.xml:88: Originally defined here.
    68. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:4: error: Resource entry common_google_play_services_install_title is already defined.
    69. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:9: Originally defined here.
    70. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:5: error: Resource entry common_google_play_services_install_text_phone is already defined.
    71. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:10: Originally defined here.
    72. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:6: error: Resource entry common_google_play_services_install_text_tablet is already defined.
    73. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:11: Originally defined here.
    74. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:7: error: Resource entry common_google_play_services_install_button is already defined.
    75. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:12: Originally defined here.
    76. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:8: error: Resource entry common_google_play_services_enable_title is already defined.
    77. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:13: Originally defined here.
    78. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:9: error: Resource entry common_google_play_services_enable_text is already defined.
    79. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:14: Originally defined here.
    80. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:10: error: Resource entry common_google_play_services_enable_button is already defined.
    81. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:15: Originally defined here.
    82. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:11: error: Resource entry common_google_play_services_update_title is already defined.
    83. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:16: Originally defined here.
    84. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:12: error: Resource entry common_google_play_services_update_text is already defined.
    85. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:17: Originally defined here.
    86. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:13: error: Resource entry common_google_play_services_network_error_title is already defined.
    87. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:18: Originally defined here.
    88. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:14: error: Resource entry common_google_play_services_network_error_text is already defined.
    89. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:19: Originally defined here.
    90. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\strings.xml:15: error: Resource entry common_google_play_services_invalid_account_title is already defined.
    91. E:\Cluffs_reliz-new-microeyes-admob\Temp\StagingArea\android-libraries\google-play-services_lib\res\values-af\common_strings.xml:20: Originally defined here.
    92. E:\Cluff
     
    Last edited: Dec 12, 2014
  6. jerryberry

    jerryberry

    Joined:
    Feb 12, 2014
    Posts:
    6
    Did you edit your AndroidManifest like creator of this plugin said?
     
  7. Danixapps

    Danixapps

    Joined:
    Jun 17, 2014
    Posts:
    5
    Hello,
    I'm using this plugin with the Google Play Games plugin, everything works, but when i use Application.Quit(); the app crashes and its closing but after 1 - 3 minutes. I have tested the plugins
    separately from my game, the problem looks like it comes from the AndroidManifest of this plugin. Any ideas?
    By the way this line is set to true by default:
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    Also one more thing. When I use .Show(); ads its hiding them not showing.
     
    Last edited: Dec 16, 2014
  8. Danixapps

    Danixapps

    Joined:
    Jun 17, 2014
    Posts:
    5
    I've manage to fix my problem for now, here is the change if anyone has this problem:
    get these lines from this line: <activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

    and put them in between this line: <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    above these lines:
    <meta-data android:name="android.app.lib_name" android:value="unity" />
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    I still want to know why when i call .Show(); its hiding the ads and if i call .Hide(); its showing them?
     
    Whalepork likes this.
  9. Danixapps

    Danixapps

    Joined:
    Jun 17, 2014
    Posts:
    5

    Don't import google-play-services_lib and the res folder from the AdMob plugin, at least this works for me.
     
  10. Whalepork

    Whalepork

    Joined:
    Sep 4, 2013
    Posts:
    18

    It fixed my problem aswell. I'm however currently using the "official" plugin. However, After doing the same changes to the manifest as you wrote. I am now unable to sign in to the googleplayservice in my app. And therefore unable to view the leaderboard.

    Are you experiencing the same problem?


    EDIT: I resolved the issue by leaving <action android:name="android.intent.action.MAIN" /> under the unityplayerProxyActivity. And also putting it under the UnityPlayerNativeActivity.

    Now however i have the issue with apps not loading after using application.quit() But i'm not using the exact same plugin as in this thread so that might be why i have that problem.
     
    Last edited: Dec 19, 2014
  11. Danixapps

    Danixapps

    Joined:
    Jun 17, 2014
    Posts:
    5
    No, I don't have any problems for now, using this plugin with the play games service plugin and the changes I've made to the manifest. Update google play service to the latest version from the android sdk manager, if you haven't done so already and try again.
     
  12. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    New Features coming up.. ;)
     
  13. Maximyz

    Maximyz

    Joined:
    Jun 8, 2013
    Posts:
    8
    Hey, guys! Please help me. Demo scene is not working. Error:

    NullReferenceException: Object reference not set to an instance of an object

    in this lines:

    Code (CSharp):
    1. InterstitialAd l_interAd = AdmobManager.Prepare<InterstitialAd>("Interstitial_1");
    2. l_interAd.AdUnitId = "ca-app-pub-4192487455949741/8306159319";
    3. l_interAd.Create();
     
  14. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Maximyz,
    which line is giving you NULL ref error, Line1 or Line2?


     
  15. Maximyz

    Maximyz

    Joined:
    Jun 8, 2013
    Posts:
    8
    MicroEyes, thank you for reply!

    It is line2
     
  16. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Sorry, forgot to ask., Are you getting this error in editor or on device?
    If you are getting this error in editor, then its obvious, because this plugin is not made to run in Editor.
    Use
    Code (csharp):
    1.  
    2. #if UNITY_ANDROID
    3. InterstitialAd l_interAd = AdmobManager.Prepare<InterstitialAd>("Interstitial_1");
    4. l_interAd.AdUnitId = "ca-app-pub-4192487455949741/8306159319";
    5. l_interAd.Create();
    6. #endif
    7.  

    And if you getting this error on device, please send me error stack..
     
  17. Maximyz

    Maximyz

    Joined:
    Jun 8, 2013
    Posts:
    8
    Oh, yes - in Editor. Sorry. Now I lunch it on Android with default settings, but bunner not shows.
     
  18. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Download the test APK(Google play) from the first page and check whether you getting Ads on the same device.
     
  19. Maximyz

    Maximyz

    Joined:
    Jun 8, 2013
    Posts:
    8
    Yes - test APK shows ads, but with delay. Now i try my game and it shows with delay too. I need to press "show" several times. Is it normal?
     
  20. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    For BannerAds. when you load Ad by bannerObj.Load(), Ad show automatically without calling Show(). same for Interstitial. Delay should the internet issue OR ad fill rate issue. but plugin is not holding any delay from itself.

    BTW, i am creating a new package with fixes & new features. It'll be up in next 4-5 hours.
     
  21. Maximyz

    Maximyz

    Joined:
    Jun 8, 2013
    Posts:
    8
    Ok, i see. Anyway, the Plugin is Great! Thank you very much, MicroEyes! I will wait for New version. It is great news! Thank you.
     
  22. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Thanks for using the plugin. ;)

    Any problem, just post here. I'll reply asap.
     
  23. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    a video will be wonderfull how to put interstitial in unity
     
  24. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    mentolatux, Thanks for your suggestion. I'll create and upload for both Interstitial & Banner shortly.
     
  25. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    yess thx man i wait and put interstitial to load every level in the game load = load interstitial ads and man add me on skipe as MENTOLATUX plzzz
     
  26. hadmaerd

    hadmaerd

    Joined:
    Sep 6, 2014
    Posts:
    13
    MicroEyes, hi.

    Your plugin is great and if use it correct it works fine, but I have question about callbacks, are you sure it works fine?

    Problem description:
    I did some tests and every time I get one weird error, here is part of my code:
    Code (CSharp):
    1. InterstitialAd l_interAd = AdmobManager.PrepareInterstitialAd("Interstitial_1");
    2.             l_interAd.AdUnitId = "ca-app-pub-4192487455949741/8306159319";
    3.             l_interAd.Create();
    4.             l_interAd.OnAdClosed = OnAdClosedEvent;
    5.             l_interAd.OnAdLoaded = OnAdLoadedEvent;
    6.             l_interAd.OnAdOpened = OnAdOpenedEvent;
    As you can see I did three events, so lets see what happens later:
    1. I load Ad :
    Code (CSharp):
    1. InterstitialAd l_interAd = AdmobManager.Get<InterstitialAd>("Interstitial_1");
    2. l_interAd.Load();
    here I get OnAdLoaded callback after some time if internet and w/e is OK. That's good, but error will be later.

    2. I show Ad:
    Code (CSharp):
    1. InterstitialAd l_interAd = AdmobManager.Get<InterstitialAd>("Interstitial_1");
    2. l_interAd.Show();
    If Ad is loaded it is shown normally, still no errors, but when I close Ad I see 2 additional OnAdLoaded callbacks in my console but there is no OnAdOpened and OnAdClosed (I think these 2 weird OnAdLoaded callbacks is OnAdOpened and OnAdClosed in fact).


    So that's problem - I can't get OnAdClosed and OnAdOpened callbacks, but I get extra OnAdLoaded callbacks when OnAdClosed and OnAdOpened is needed.

    P.S. OnAdFailedToLoad works fine.
     
    Last edited: Feb 10, 2015
  27. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Hi hadmaerd,
    Thanks for filling the bug. I have already resolved these callback issues. Wait for next update.
     
  28. hadmaerd

    hadmaerd

    Joined:
    Sep 6, 2014
    Posts:
    13
    After that your plugin is going to be the best in right hands. =) I would have definitely made a donation for your wonderful job if only I wasn't a poor student.))
     
  29. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    .......New Version 3.1.2 out......
     
  30. soundmartell

    soundmartell

    Joined:
    Oct 31, 2013
    Posts:
    16
    Hello,
    How can I use Admob plugin with Vuforia plugin in my Unity project? Is it any way to merge the AndroidManifest?
    I will appreciate any help.
    Regards.
     
  31. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Hi soundmartell,
    This plugin is not derived from AndroidActivity so not much effort involved. To Merge AndroidManifest.xml, do:

    1. In Application tag, add
    Code (csharp):
    1. <meta-data android:name="com.google.android.gms.version"
    2.                android:value="@integer/google_play_services_version"/>]/CODE]
    3.  
    4. 2. Add
    5. [CODE]<activity android:name="com.google.android.gms.ads.AdActivity"
    6.              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

    3. Add Permissions:
    Code (csharp):
    1. <uses-permission android:name="android.permission.INTERNET"/>
    2.     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    4. In your Activity tag(Vuforia Activity), add:
    Code (csharp):
    1. <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
     
  32. soundmartell

    soundmartell

    Joined:
    Oct 31, 2013
    Posts:
    16
    Thank you for your answer, I am starting with Android and it is not easy for me to understand where to add thous codes.
    This is my AndroidManifest, Could you please have a look and let me know where to add the codes?

    <?xmlversion="1.0"encoding="utf-8"?>
    <manifestxmlns:android="http://schemas.android.com/apk/res/android"package="com.qualcomm.QCARUnityPlayer"android:versionCode="1"android:versionName="1.0">
    <uses-sdkandroid:minSdkVersion="8"/>
    <uses-featureandroid:name="android.hardware.camera"/>
    <supports-screensandroid:smallScreens="true"android:normalScreens="true"android:largeScreens="true"android:anyDensity="true"/>
    <uses-permissionandroid:name="android.permission.INTERNET"/>
    <uses-permissionandroid:name="android.permission.CAMERA"/>
    <uses-permissionandroid:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <applicationandroid:icon="@drawable/app_icon"android:label="@String/app_name"android:theme="@android:style/Theme.NoTitleBar.Fullscreen"android:debuggable="false">
    <activityandroid:name="com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity"android:label="@String/app_name"android:screenOrientation="portrait"android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    <meta-dataandroid:name="android.app.lib_name"android:value="unity"/>
    <meta-dataandroid:name="unityplayer.ForwardNativeEventsToDalvik"android:value="false"/>
    <intent-filter>
    <actionandroid:name="android.intent.action.MAIN"/>
    <categoryandroid:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
    </activity>
    <activityandroid:name="com.unity3d.player.VideoPlayer"android:label="@String/app_name"android:screenOrientation="portrait"android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    </activity>
    </application>
    </manifest>
    <!--android:installLocation="preferExternal" -->

    Thank you very much for your support.
     
  33. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    soundmartell, Try this
    Code (csharp):
    1.  
    2. <?xmlversion="1.0"encoding="utf-8"?>
    3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.qualcomm.QCARUnityPlayer"android:versionCode="1"android:versionName="1.0">
    4. <uses-sdk android:minSdkVersion="8"/>
    5. <uses-featurea ndroid:name="android.hardware.camera"/>
    6. <supports-screens android:smallScreens="true"android:normalScreens="true"android:largeScreens="true"android:anyDensity="true"/>
    7. <uses-permission android:name="android.permission.INTERNET"/>
    8. <uses-permission android:name="android.permission.CAMERA"/>
    9. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    10. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    11. <application android:icon="@drawable/app_icon"android:label="@String/app_name"android:theme="@android:style/Theme.NoTitleBar.Fullscreen"android:debuggable="false">
    12. <meta-data android:name="com.google.android.gms.version"
    13.                android:value="@integer/google_play_services_version"/> <!-- Added for Admob Plugin -->
    14. <activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity"android:label="@String/app_name"android:screenOrientation="portrait"android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    15. <meta-dataa ndroid:name="android.app.lib_name"android:value="unity"/>
    16. <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik"android:value="false"/>
    17. <intent-filter>
    18. <action android:name="android.intent.action.MAIN"/>
    19. <category android:name="android.intent.category.LAUNCHER"/>
    20. </intent-filter>
    21. </activity>
    22. <activity android:name="com.unity3d.player.VideoPlayer"android:label="@String/app_name"android:screenOrientation="portrait"android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    23. </activity>
    24.  
    25. <activity android:name="com.google.android.gms.ads.AdActivity"
    26.              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>   <!-- Added for Admob Plugin -->
    27. </application>
    28. </manifest>
    29. <!--android:installLocation="preferExternal" -->
    30.  
    31.  
     
  34. youngexplorer

    youngexplorer

    Joined:
    Nov 4, 2014
    Posts:
    5
    Hi MicroEyes,
    It's a wonderful plugin, that helps so much. I have one small problem with showing banner ads. I want the banner to appear at the end scene (after the player finish play, win or lose, they go to the end scene). When they click to play again, the banner would be hidden (via AdmobManager.HideBanner). They can go on playing without any banner obstructing view.

    But usually, the first play any time the game open, the banner load slow so there was nothing to hide when they click to go back to play. So when they go back to play in the main scene again, the banner appears. After the first play, the ads behave exactly as intended (show when the end scene open, hide when click)

    The question is how do I check if the banner is on screen so I can hide it?
     
  35. soundmartell

    soundmartell

    Joined:
    Oct 31, 2013
    Posts:
    16
    Thank you for your help and support, I will try it for sure, anyway I already solved by myself
    Best regards.
     
  36. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Hi youngexplorer,
    I'll add property to check whether BannerAd LoadedVisible or not. Give me 2-3days from now.
     
  37. youngexplorer

    youngexplorer

    Joined:
    Nov 4, 2014
    Posts:
    5
    I think that would be a kick ass feature. Cheer MircoEyes
     
  38. Marwan_Ayyad

    Marwan_Ayyad

    Joined:
    Apr 1, 2014
    Posts:
    12
    my Interstitial Ads show when player dies , the problem is it show only once and never show again what i did wrong? ,this's my code
    (to create InterstitialAd when scene load or restarted )
    Code (CSharp):
    1. void Start () {
    2.         #if UNITY_ANDROID
    3.         InterstitialAd l_interAd = AdmobManager.Prepare<InterstitialAd>("Interstitial_1");
    4.         l_interAd.AdUnitId = "ca-app-pub-5216337907404206/7735777973";
    5.         l_interAd.Create();
    6.         l_interAd.Load();
    7.         #endif
    8.   }
    9.  
    (and here i show InterstitialAd when player dies)
    Code (CSharp):
    1.     void OnTriggerEnter (Collider other)
    2.     {
    3.  
    4.         #if UNITY_ANDROID
    5.         InterstitialAd l_interAd = AdmobManager.Get<InterstitialAd>("Interstitial_1");
    6.      
    7.         if (l_interAd.IsLoaded) {
    8.             l_interAd.Show ();
    9.         }
    10.         #endif
    11.  
    12.     }
     
  39. Marwan_Ayyad

    Marwan_Ayyad

    Joined:
    Apr 1, 2014
    Posts:
    12
    Never Mind i fixed it by adding this code
    Code (CSharp):
    1.     bool created=false;
    2.     void Awake() {
    3.         DontDestroyOnLoad(gameObject);
    4.         if (!created) {
    5.             // this is the first instance - make it persist
    6.             DontDestroyOnLoad(this.gameObject);
    7.             created = true;
    8.         } else {
    9.             // this must be a duplicate from a scene reload - DESTROY!
    10.             Destroy(this.gameObject);
    11.         }  
    12.     }
    13.     // Use this for initialization
    14.     void Start () {
    15.  
    16.  
    17.         #if UNITY_ANDROID
    18.         DontDestroyOnLoad(this.gameObject);
    19.         InterstitialAd l_interAd = AdmobManager.Prepare<InterstitialAd>("Interstitial_1");
    20.         l_interAd.AdUnitId = "ca-app-pub-5216337907404206/7735777973";
    21.         l_interAd.Create();
    22.         l_interAd.Load();
    23.         #endif
    24.  
    25.     }
    and when player dies
    Code (CSharp):
    1. void OnTriggerEnter (Collider other)
    2.     {  
    3.  
    4.         #if UNITY_ANDROID
    5.         InterstitialAd l_interAd = AdmobManager.Get<InterstitialAd>("Interstitial_1");
    6.        
    7.         if (l_interAd.IsLoaded) {
    8.             l_interAd.Show ();
    9.             l_interAd.Load();
    10.         }
    11.         #endif
    12.     }
     
  40. youngexplorer

    youngexplorer

    Joined:
    Nov 4, 2014
    Posts:
    5
    Hi MicroEyes,
    It is possible to make load banner ad and show banner ad are two separate events? I think it would be easier to control load time and error from banner loading. For example, I want the ad to load in the background so when the it's shown, it would show up immediately instead of waiting for it to load.
     
  41. MicroEyes

    MicroEyes

    Joined:
    Jul 3, 2012
    Posts:
    309
    Hi youngexplorer,
    I am doing the exact thing
     
  42. youngexplorer

    youngexplorer

    Joined:
    Nov 4, 2014
    Posts:
    5
    Hi MicroEyes,
    I would want to send you the game so you can see the credit. Hopefully with your latest implementation.
     
  43. rbreve

    rbreve

    Joined:
    Feb 27, 2014
    Posts:
    9
    Hello,

    When trying to build for iOS I get, I'm using unity 5

    Cross compilation job AdmobUnity.dll failed.
    UnityEngine.UnityException: Failed AOT cross compiler: /Applications/Unity/Unity.app/Contents/PlaybackEngines/iossupport/Tools/OSX/mono-xcompiler-wrapper.sh --aot=full,asmonly,nodebug,static,outfile="AdmobUnity.dll.s" "AdmobUnity.dll" current dir : /Users/Developer/Unity/Crecer/Temp/StagingArea/Data/Managed
    result file exists: False. Timed out: False


    I checked that directory and the file is there.
     
  44. soundmartell

    soundmartell

    Joined:
    Oct 31, 2013
    Posts:
    16
    Hello,
    Starting today my app is crashing in my Galaxy S6 - Unity 5. If I unable My Admob script everything work fine.
    Does Admob support unity 5?
    This is my script, Is it something wrong?
    Thank you for any help and support,
    Livan.

    usingUnityEngine;
    usingSystem.Collections;
    usingcom.microeyes.admob;


    [ExecuteInEditMode]
    publicclassAdmob : MonoBehaviour {

    privateRectm_rect = newRect();
    //privateconstboolallowCarrierDataNetwork = false;
    //privateconststringpingAddress = "8.8.8.8"; // GooglePublicDNSserver
    //privateconstfloatwaitingTime = 2.0f;
    //publicGameObjectNo_Internet;

    //privatePingping;
    //privatefloatpingStartTime;

    voidOnGUI()
    {
    DrawBannerAdvs();


    m_rect.y = Screen.height - m_rect.height - 20;
    m_rect.x = Screen.width - m_rect.width;
    }

    voidDrawBannerAdvs()
    {
    m_rect.x = 20;
    m_rect.y = 50;

    m_rect.width = Screen.width * 0.2f;
    m_rect.height = Screen.height * 0.12f;

    CreateBanner ();
    LoadBanner ();

    }


    privatevoidCreateBanner(){

    //AdmobManager.CreateBannerAd("Banner_1"); //Simple, withdefaultoptions
    //OR
    BannerAdl_bannerAd = AdmobManager.Prepare<BannerAd>("Banner_1");
    l_bannerAd.BannerType = EBannerAdType.SMART_BANNER;
    l_bannerAd.Orientation = EOrientation.HORIZONTAL;
    l_bannerAd.AnimInType = EAnimationInType.FADE_IN;
    l_bannerAd.AnimOutType = EAnimationOutType.SLIDE_OUT_RIGHT;
    l_bannerAd.SetPosition(EPosition.CENTER_HORIZONTAL, EPosition.BOTTOM);


    l_bannerAd.Create();

    m_rect.y = m_rect.y + m_rect.height;

    }
    privatevoidLoadBanner(){

    AdmobManager.Load("Banner_1");
    //OR
    //BannerAdl_bannerAd = AdmobManager.Get<BannerAd>("Banner_1");
    //l_bannerAd.Load();
    m_rect.y = m_rect.y + m_rect.height;

    }

    //Just check if Internet Connection is available if yes show ads otherwise show something else.
    /*publicvoidStart()
    {
    boolinternetPossiblyAvailable;
    switch (Application.internetReachability)
    {
    caseNetworkReachability.ReachableViaLocalAreaNetwork:
    internetPossiblyAvailable = true;
    break;
    caseNetworkReachability.ReachableViaCarrierDataNetwork:
    internetPossiblyAvailable = allowCarrierDataNetwork;
    break;
    default:
    internetPossiblyAvailable = false;
    break;
    }
    if (!internetPossiblyAvailable)
    {
    InternetIsNotAvailable();
    return;
    }
    ping = newPing(pingAddress);
    pingStartTime = Time.time;
    }

    publicvoidUpdate()
    {
    if (ping != null)
    {
    boolstopCheck = true;
    if (ping.isDone)
    InternetAvailable();
    elseif (Time.time - pingStartTime < waitingTime)
    stopCheck = false;
    else
    InternetIsNotAvailable();
    if (stopCheck)
    ping = null;
    }
    }

    privatevoidInternetIsNotAvailable()
    {
    No_Internet.SetActive (true);
    Debug.Log("No Internet :(");
    }

    privatevoidInternetAvailable()
    {
    No_Internet.SetActive (false);

    Debug.Log("Internet is available! ;)");
    }
    */
    }
     
  45. soundmartell

    soundmartell

    Joined:
    Oct 31, 2013
    Posts:
    16
    Well, Admob plugin is working with Unity 5 in other devices as Note 3. The issue is with the Samsung Galaxy S6 Edge. For some unknown reason it cause the APP to crash instantly. I will appreciate any help or advice.
    I tried the Admob sample scene getting the same issue.
    Regards.
     
  46. Gersio

    Gersio

    Joined:
    Dec 3, 2014
    Posts:
    1
    Hello MicroEyes,

    Is it compatible with the "Play Games Services" plugin provided by Google?

    And thank you for this awesome work!
     
  47. Dnine

    Dnine

    Joined:
    Oct 10, 2013
    Posts:
    6
    Hello,
    How you solve that? i have similar problem in my vuforia project and MicroEyes ads plugin.
    if you can share how you solve it, it will be great.

    Thankyou.