Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by FerdinandBuagas · Oct 24, 2017 at 10:52 AM · admobdevelopment build

Unable to Show Admob ads | Development Build

Hello Guys,

I would like to ask for advice. I am able to see the admob ads in my emulator and also with real device, if in my Build Settings the Development Build is Checked.

alt text

But if not, no Ads at all.

Will it be okay to build an APK to be released in Google Play Store even if the Development Build is checked?

Sorry I'm new in Unity.

The Code:

 using UnityEngine;
 using System.Collections;
 using GoogleMobileAds.Api;
 
 public class AdScript : MonoBehaviour
 {
 
     bool isShown;
     InterstitialAd interstitial;
 
     void Start()
     {
         
         RequestInterstitialAds();
     }
 
     void Update()
     {
         if (GameControl.isGameOver)
         {
             if (!isShown)
             {
                 isShown = true;
                 showInterstitialAd();
             }
         }
     }
 
     public void showInterstitialAd()
     {
         
         if (interstitial.IsLoaded())
         {
             interstitial.Show();
             
         }
 
     }
 
     
     private void RequestInterstitialAds()
     {
         //Testing
         string adID = "ca-app-pub-3940256099942544/1033173712";
 
         //Live
         //string adID = "MY ADD ID";                     
 
         #if UNITY_ANDROID
         string adUnitId = adID;
         #elif UNITY_IOS
         string adUnitId = adID;
         #else
         string adUnitId = adID;
         #endif
             
         // Initialize an InterstitialAd.
         interstitial = new InterstitialAd(adUnitId);
 
         //Test
         AdRequest request = new AdRequest.Builder()
         .AddTestDevice(AdRequest.TestDeviceSimulator)       // Simulator.
         .AddTestDevice("89D1DA1F820CE28BA86223A1C34****")  // My test device.
         .Build();
 
         //Production
         //AdRequest request = new AdRequest.Builder().Build();
 
         //Register Ad Close Event
         interstitial.OnAdClosed += Interstitial_OnAdClosed;
 
         //Load the interstitial with the request.
         interstitial.LoadAd(request);
 
         //Debug.Log("AD LOADED XXX");
 
     }
 
     
     private void Interstitial_OnAdClosed(object sender, System.EventArgs e)
     {
     //Resume Play Sound
     }
 }
 


Thanks in advance.

development-build.jpg (21.6 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by FerdinandBuagas · Nov 01, 2017 at 06:03 AM

To those who encounters this error:

enable the "User Proguard File", Then on the proguard-user.txt. add this.

 -keep public class com.google.android.gms.ads.{
 public *;
 }
 
 # For old ads classes
 -keep public class com.google.ads.{
 public *;
 }
 
 # For mediation
 -keepattributes Annotation
 
 # Other required classes for Google Play Services
 # Read more at http://developer.android.com/google/play-services/setup.html
 -keep class * extends java.util.ListResourceBundle {
 protected Object[][] getContents();
 }
 
 -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
 public static final * NULL;
 }
 
 -keepnames @com.google.android.gms.common.annotation.KeepName class *
 -keepclassmembernames class * {
 @com.google.android.gms.common.annotation.KeepName *;
 }
 
 -keepnames class * implements android.os.Parcelable {
 public static final  CREATOR;
 }
 
 -keep public class com.google.unity.**{
 public *;
 }

Note: This does solve my issue, But I'm not sure how will this code affect the project, Anyone have an idea? Need advice on this.

By the way I found this here: https://github.com/googleads/googleads-mobile-unity/issues/539

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

70 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The ads on my game runs when I run it on development build but not in release build. 1 Answer

Google Admob ads not showing in the game 3 Answers

Development Build 0 Answers

AdMob + Unity + Emulator = No Ad? (Is it supposed to be like this?) 0 Answers

How do Smart Banners scale? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges