title: Admob ads not shown after applied ProGuard rules
body: <p>I just finished my app and in final stage before published, but unfortunately I facing problem with Admob ads, I cannot see it after generate the signed apk with ProGuard rules, the ads shown normally when I run app from android studio, I see the <a href="https://stackoverflow.com/questions/13344305/admob-ads-are-not-shown-with-pro-guard">question</a> , and I tried all rules provided but didn't working!</p>
  
  <p><strong>mainActivity ad banner</strong></p>
  
  <pre><code>   public static void mainActivityBanner() {
          AdRequest adRequest = new AdRequest.Builder().build();
          adView.loadAd(adRequest);
  
  
          adView.setAdListener(new AdListener() {
              @Override
              public void onAdLoaded() {
                  // Code to be executed when an ad finishes loading.
  
              }
  
              @Override
              public void onAdFailedToLoad(int errorCode) {
                  // Code to be executed when an ad request fails.
  
                  Log.e("AD ERROR", "error code" + errorCode);
              }
  
              @Override
              public void onAdOpened() {
                  // Code to be executed when an ad opens an overlay that
                  // covers the screen.
              }
  
              @Override
              public void onAdLeftApplication() {
                  // Code to be executed when the user has left the app.
  
              }
  
              @Override
              public void onAdClosed() {
                  // Code to be executed when when the user is about to return
                  // to the app after tapping on an ad.
  
              }
          });
      }
  </code></pre>
  
  <p><strong>detailsActivity ads</strong></p>
  
  <pre><code>public static void detailsActivityBanner(){
          AdRequest adRequest = new AdRequest.Builder().build();
          adView.loadAd(adRequest);
  
  
          adView.setAdListener(new AdListener() {
              @Override
              public void onAdLoaded() {
                  // Code to be executed when an ad finishes loading.
  
              }
  
              @Override
              public void onAdFailedToLoad(int errorCode) {
                  // Code to be executed when an ad request fails.
  
                  Log.e("AD ERROR", "error code" + errorCode);
              }
  
              @Override
              public void onAdOpened() {
                  // Code to be executed when an ad opens an overlay that
                  // covers the screen.
              }
  
              @Override
              public void onAdLeftApplication() {
                  // Code to be executed when the user has left the app.
  
              }
  
              @Override
              public void onAdClosed() {
                  // Code to be executed when when the user is about to return
                  // to the app after tapping on an ad.
  
              }
          });
      }
  
      public static void detailsActivityInterstitial(){
          interstitialAd.setAdListener(new AdListener() {
              @Override
              public void onAdLoaded() {
                  // Code to be executed when an ad finishes loading.
                  if(clickNumber == 1){
                      interstitialAd.show();
                  }else {
                      clickNumber++;
                  }
  
              }
  
              @Override
              public void onAdFailedToLoad(int errorCode) {
                  // Code to be executed when an ad request fails.
              }
  
              @Override
              public void onAdOpened() {
                  // Code to be executed when the ad is displayed.
              }
  
              @Override
              public void onAdLeftApplication() {
                  // Code to be executed when the user has left the app.
                  clickNumber = 0;
              }
  
              @Override
              public void onAdClosed() {
                  // Code to be executed when the interstitial ad is closed.
                  clickNumber = 0;
  
              }
          });
      }
  </code></pre>
  
  <p>here's my <strong><code>proguard-rules.pro file</code></strong></p>
  
  <pre><code># Add project specific ProGuard rules here.
  # You can control the set of applied configuration files using the
  # proguardFiles setting in build.gradle.
  #
  # For more details, see
  #   http://developer.android.com/guide/developing/tools/proguard.html
  
  # If your project uses WebView with JS, uncomment the following
  # and specify the fully qualified class name to the JavaScript interface
  # class:
  #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
  #   public *;
  #}
  
  # Uncomment this to preserve the line number information for
  # debugging stack traces.
  #-keepattributes SourceFile,LineNumberTable
  
  # If you keep the line number information, uncomment this to
  # hide the original source file name.
  #-renamesourcefileattribute SourceFile
  
  # This is a configuration file for ProGuard.
  -dontusemixedcaseclassnames
  -dontskipnonpubliclibraryclasses
  -verbose
  -dontpreverify
  
  -dontnote android.net.http.*
  -dontnote org.apache.commons.codec.**
  -dontnote org.apache.commons.logging.**
  -dontnote org.apache.http.**
  
  
  # Enable Optimization. # Optimization is turned off by default.
  -optimizations   code/simplification/arithmetic,!code/simplification/cast,!field
  -optimizationpasses 5
  -allowaccessmodification
  
  
  #Disable Optimization
  #-dontoptimize
  #-dontpreverify
  
  # Remove Log command from code
  -assumenosideeffects class android.util.Log{
   public static *** d(...);
   public static *** i(...);
   public static *** v(...);
  }
  
  # -------------------------------------------------
  -keep public class * extends android.app.Activity
  -keep public class * extends android.app.Application
  -keep public class * extends android.app.Service
  -keep public class * extends android.content.BroadcastReceiver
  -keep public class * extends android.content.ContentProvider
  -keep public class * extends android.app.backup.BackupAgentHelper
  -keep public class * extends android.app.backup.BackupAgent
  -keep public class * extends android.preference.Preference
  
  -keep public class * extends android.support.v4.app.Fragment
  -keep public class * extends android.support.v4.app.DialogFragment
  -keep public class * extends com.actionbarsherlock.app.SherlockListFragment
  -keep public class * extends com.actionbarsherlock.app.SherlockFragment
  -keep public class * extends android.app.Fragment
  -keep public class com.android.vending.licensing.ILicensingService
  -keep public class * extends java.lang.Exception
  
  # -------------------------------------------------
  -injars libs
  -keepattributes *Annotation*, Signature, Exception, EnclosingMethod, InnerClasses
  -keepattributes JavascriptInterface
  
  # Keep source file name and line number
  -keepattributes SourceFile,LineNumberTable
  
  -keep class okhttp3.** {*;}
  -keep interface okhttp3.** {*;}
  -dontwarn okhttp3.**
  
  -keep class okio.** { *; }
  -keep interface okio.** { *; }
  -dontwarn okio.**
  
  -keep class org.apache.http.** { *; }
  -keep class org.apache.james.mime4j.** { *; }
  -dontwarn org.apache.**
  
  -keep class com.activeandroid.** { *; }
  -keep class com.activeandroid.**.** { *; }
  -dontwarn com.activeandroid.**
  
  -keep class * extends com.activeandroid.Model
  -keep class * extends com.activeandroid.serializer.TypeSerializer
  
  -keep class android.support.v7.** { *; }
  -keep interface android.support.v7.** { *; }
  -dontwarn android.support.v7.**
  
  # Dontwarn-----------------------------------------
  -dontwarn javax.**
  -dontwarn java.lang.management.**
  -dontwarn org.apache.log4j.**
  -dontwarn org.apache.commons.logging.**
  -dontwarn android.support.**
  -dontwarn com.google.ads.**
  -dontwarn org.slf4j.**
  -dontwarn org.json.**
  
  
  -keep public class * extends android.view.View {
      public &lt;init&gt;(android.content.Context);
      public &lt;init&gt;(android.content.Context, android.util.AttributeSet);
      public &lt;init&gt;(android.content.Context, android.util.AttributeSet, int);
      public void set*(...);
  }
  
  
  # -------------------------------------------------
  -keepclasseswithmembers class * {
      public &lt;init&gt;(android.content.Context, android.util.AttributeSet);
  }
  
  -keepclasseswithmembers class * {
      public &lt;init&gt;(android.content.Context, android.util.AttributeSet, int);
  }
  -keepclasseswithmembernames class * {
      native &lt;methods&gt;;
  }
  
  
  -keepclassmembers class * extends android.content.Context {
     public void *(android.view.View);
     public void *(android.view.MenuItem);
  }
  
  -keepclassmembers class * implements android.os.Parcelable {
      static ** CREATOR;
  }
  
  -keepclassmembers class * implements java.io.Serializable {
      static final long serialVersionUID;
      private static final java.io.ObjectStreamField[] serialPersistentFields;
      !static !transient &lt;fields&gt;;
      private void writeObject(java.io.ObjectOutputStream);
      private void readObject(java.io.ObjectInputStream);
      java.lang.Object writeReplace();
      java.lang.Object readResolve();
  }
  
  -keepclassmembers class * extends android.app.Activity {
     public void *(android.view.View);
  }
  
  -keepclassmembers enum * {
      public static **[] values();
      public static ** valueOf(java.lang.String);
  }
  
  -keepclassmembers class **.R$* {
      public static &lt;fields&gt;;
  }
  
  -keepclassmembers class * {
      @android.webkit.JavascriptInterface &lt;methods&gt;;
  }
  
  
  # Support Library
  -keep class android.support.** {*;}
  -keep interface android.support.** {*;}
  
  
  # Needed when building against Marshmallow SDK.
    -dontwarn android.app.Notification
  
  
  # Retrofit and GSON
  -keep class com.squareup.okhttp3.** { *; }
  -keep interface com.squareup.okhttp3.** { *; }
  -dontwarn com.squareup.okhttp3.**
  
  -keep class retrofit2.** { *; }
  -dontwarn retrofit2.**
  
  -keep class com.google.gson.** { *; }
  -dontwarn com.google.gson.**
  
  -keep class sun.misc.Unsafe.** { *; }
  -dontwarn sun.misc.Unsafe.**
  
  -keep public class com.google.gson.** {*;}
  -keep class * implements com.google.gson.** {*;}
  -keep class com.google.gson.stream.** { *; }
  -dontwarn com.google.gson.**
  
  #-keep class * implements com.google.gson.TypeAdapterFactory
  #-keep class * implements com.google.gson.JsonSerializer
  #-keep class * implements com.google.gson.JsonDeserializer
  
  -keepclasseswithmembers class * {@retrofit2.http.* &lt;methods&gt;;}
  -keepclasseswithmembers interface * { @retrofit2.* &lt;methods&gt;;}
  -dontwarn com.google.appengine.**
  -dontwarn java.nio.file.**
  -dontwarn org.codehaus.**
  -dontwarn org.codehaus.mojo.**
  -dontwarn retrofit2.Platform$Java8
  -dontnote retrofit2.Platform
  -dontnote retrofit2.Platform$IOS$MainThreadExecutor
  
  
  # Volley
  -keep class com.android.volley.** { *; }
  -dontwarn com.android.volley.**
  
  
  ## Butterknife 8.0
  -keep public class * implements butterknife.Unbinder { public &lt;init&gt;(**, android.view.View); }
  -keep class butterknife.*
  -keepclasseswithmembernames class * { @butterknife.* &lt;methods&gt;; }
  -keepclasseswithmembernames class * { @butterknife.* &lt;fields&gt;; }
  
  
  # EventBus
  -keepclassmembers class * {
      @org.greenrobot.eventbus.Subscribe &lt;methods&gt;;
  }
  -keep enum org.greenrobot.eventbus.ThreadMode { *; }
  # Only required if you use AsyncExecutor
  -keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
      &lt;init&gt;(java.lang.Throwable);
  }
  
  
  # OkHttp and Picasso
  -keep class com.squareup.okhttp.** { *; }
  -keep interface com.squareup.okhttp.** { *; }
  -dontwarn com.squareup.okhttp.**
  
  
  
  # Keep line number
  -keepattributes SourceFile,LineNumberTable
  
  
  # Google Play Admob
      -keep public class com.google.android.gms.ads.** {
          public *;
      }
  
      -keep public class com.google.ads.** {
           public *;
      }
  
      -keep class com.google.ads.** # Don't proguard AdMob classes
      -dontwarn com.google.ads.** # Temporary workaround for v6.2.1. It gives a warning that you can ignore
  
  # Lru Cache
  -keep class com.squareup.picasso.LruCache { *; }
  -dontwarn com.squareup.picasso.LruCache.**
  
  # Firebase
  -keep class com.firebase.** { *; }
  -dontwarn com.firebase.**
  
  -keepnames class com.shaded.fasterxml.** { *; }
  -dontwarn org.shaded.apache.**
  
  -keep class org.apache.** { *; }
  -dontwarn org.apache.**
  
  -keepnames class org.ietf.jgss.** { *; }
  -dontwarn org.ietf.jgss.**
  
  -keepnames class com.fasterxml.jackson.** { *; }
  -dontwarn com.fasterxml.**
  
  -keepnames class javax.servlet.** { *; }
  
  -dontwarn org.w3c.dom.**
  -dontwarn org.joda.time.**
  -dontnote com.firebase.client.core.GaePlatform
  
  ## Android architecture components: Lifecycle
  # LifecycleObserver's empty constructor is considered to be unused by proguard
  -keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver {
      &lt;init&gt;(...);
  }
  # ViewModel's empty constructor is considered to be unused by proguard
  -keepclassmembers class * extends android.arch.lifecycle.ViewModel {
      &lt;init&gt;(...);
  }
  # keep Lifecycle State and Event enums values
  -keepclassmembers class android.arch.lifecycle.Lifecycle$State { *; }
  -keepclassmembers class android.arch.lifecycle.Lifecycle$Event { *; }
  # keep methods annotated with @OnLifecycleEvent even if they seem to be unused
  # (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows)
  -keepclassmembers class * {
      @android.arch.lifecycle.OnLifecycleEvent *;
  }
  
  -keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver {
      &lt;init&gt;(...);
  }
  
  -keep class * implements android.arch.lifecycle.LifecycleObserver {
      &lt;init&gt;(...);
  }
  -keepclassmembers class android.arch.** { *; }
  -keep class android.arch.** { *; }
  -dontwarn android.arch.**
  
  -keep class com.github.ybq.android.spinkit.SpinKitView
  -dontwarn com.github.ybq.android.spinkit.SpinKitView
  
  
  #Glide
  -keep public class * implements com.bumptech.glide.module.GlideModule
  -keep public class * extends com.bumptech.glide.module.AppGlideModule
  -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
    **[] $VALUES;
    public *;
  }
  -dontwarn com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool
  -dontwarn com.bumptech.glide.load.resource.bitmap.Downsampler
  -dontwarn com.bumptech.glide.load.resource.bitmap.HardwareConfigState
  
  -keep class com.google.**
  -dontwarn com.google.**
  -dontwarn sun.misc.Unsafe
  
  -keep class org.ocpsoft.prettytime.** {*;}
  -dontwarn org.ocpsoft.prettytime.**
  
  -keep class com.androidfung.geoip.**{*;}
  -dontwarn com.androidfung.geoip.**
  
  -keep class www.pro_cs_is.com.Utils.**{*;}
  
  </code></pre>