java.lang.RuntimeException: Unable to start activity ComponentInfo when using admob sdk
<p>I'm pretty sure this is nothing about the <code>Theme.AppCompat</code>, because the proguard-enabled app was originally works well without <code>com.google.android.gms:play-services-ads:7.5.0</code>, things went wrong after added <code>com.google.android.gms:play-services-ads:7.5.0</code>.</p>

<p>With <code>com.google.android.gms:play-services-ads</code> included, it only works when proguard disabled.</p>

<p>Can someone please help? I really hate java's inability in protecting source code and wish I could never use proguard.</p>

<p><strong>Error Stack</strong></p>

<blockquote>
  <p>FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start
  activity
  ComponentInfo{com.company.project/com.company.project.MainActivity}:
  java.lang.IllegalStateException: You need to use a Theme.AppCompat
  theme (or descendant) with this activity.
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2463)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520)
      at android.app.ActivityThread.access$600(ActivityThread.java:162)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:158)
      at android.app.ActivityThread.main(ActivityThread.java:5751)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
      at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat
  theme (or descendant) with this activity.
      at android.support.v7.a.ae.q(Unknown Source)
      at android.support.v7.a.ae.p(Unknown Source)
      at android.support.v7.a.ae.a(Unknown Source)
      at android.support.v7.a.u.setContentView(Unknown Source)
      at com.company.project.MainActivity.onCreate(Unknown Source)
      at android.app.Activity.performCreate(Activity.java:5165)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1103)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2419)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520) 
      at android.app.ActivityThread.access$600(ActivityThread.java:162) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366) 
      at android.os.Handler.dispatchMessage(Handler.java:99) 
      at android.os.Looper.loop(Looper.java:158) 
      at android.app.ActivityThread.main(ActivityThread.java:5751) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:511) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850) 
      at dalvik.system.NativeStart.main(Native Method)</p>
</blockquote>

<p><strong>Gradle:</strong></p>

<pre><code>android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.company.project"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        debug {
        // proguard enabled for debug
            minifyEnabled true
            FileCollection proGuardFileCollection = files { file('./proguard').listFiles() }
            proguardFiles(proGuardFileCollection)
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
        release {
            minifyEnabled true
            FileCollection proGuardFileCollection = files { file('./proguard').listFiles() }
            proguardFiles(proGuardFileCollection)
            proguardFiles getDefaultProguardFile('proguard-android.txt')

        }
    }
}

dependencies {
    compile project(':vitamio')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.facebook.fresco:fresco:0.8.1'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'in.srain.cube:ultra-ptr:1.0.11'
    compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'

    compile 'com.google.android.gms:play-services-ads:7.5.0'

    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }

}

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'

apply plugin: 'io.fabric'
repositories {
    maven { url 'https://maven.fabric.io/public' }
}
</code></pre>

<p><strong>AndroidManifes.xml:</strong></p>

<p>

    
    
    
    
    
    
    </p>

<pre><code>&lt;application
    android:allowBackup="true"
    android:icon="@mipmap/logo"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"&gt;

&lt;!-- note: @style/AppTheme is defined as
&lt;style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
    &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
    &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
    &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt;
&lt;/style&gt; 
--&gt;

    &lt;activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;

            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity android:name=".VideoPlayerActivity" android:theme="@style/AppTheme.NoActionBar"/&gt;
    &lt;activity android:name=".VideoActivity" android:theme="@style/AppTheme.NoActionBar"/&gt;

    &lt;!--AdMob--&gt;
    &lt;meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version"/&gt;
    &lt;activity android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent" /&gt;


&lt;/application&gt;
</code></pre>

<p></p>

<p><strong>Proguard for admob (copied from admob's example on github):</strong></p>

<pre><code># For Google Play Services
-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;
}
</code></pre>