title: Android Studio: Unable to start activity ComponentInfo
body: <p>If I try to start my Application following error appears:</p>
  
  <pre><code>07-13 17:51:04.663 23276-23276/com.aaron.waller.angelasoundboard E/AndroidRuntime: FATAL EXCEPTION: main
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aaron.waller.angelasoundboard/com.aaron.waller.angelasoundboard.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
      at android.app.ActivityThread.access$700(ActivityThread.java:159)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:137)
      at android.app.ActivityThread.main(ActivityThread.java:5419)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:525)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
      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.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:355)
      at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:324)
      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:285)
      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
      at com.aaron.waller.angelasoundboard.MainActivity.onCreate(MainActivity.java:40)
      at android.app.Activity.performCreate(Activity.java:5372)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) 
      at android.app.ActivityThread.access$700(ActivityThread.java:159) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 
      at android.os.Handler.dispatchMessage(Handler.java:99) 
      at android.os.Looper.loop(Looper.java:137) 
      at android.app.ActivityThread.main(ActivityThread.java:5419) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:525) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 
      at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p> </p>
  
  <p>The issue should be in this code:</p>
  
  <pre><code> @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  }
  </code></pre>
  
  <p>my activity_main.xml:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:ads="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      android:orientation="vertical"&gt;
  
  
  
  
  
      &lt;android.support.v7.widget.Toolbar
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/colorAccent"
          android:id="@+id/toolbar"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
          app:title="Angela Merkel Soundboard" /&gt;
  
      &lt;android.support.v4.widget.DrawerLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_height="match_parent"
          android:layout_width="match_parent"
          android:id="@+id/drawerLayout"&gt;
  
  
  
  
          &lt;FrameLayout
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:id="@+id/containerView"&gt;
  
  
  
              &lt;com.google.android.gms.ads.AdView
                  android:id="@+id/adView"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerHorizontal="true"
                  android:layout_alignParentBottom="true"
                  ads:adSize="SMART_BANNER"
                  android:layout_gravity="bottom|end"
                  ads:adUnitId="@string/banner_ad_unit_id"&gt;
              &lt;/com.google.android.gms.ads.AdView&gt;
  
          &lt;/FrameLayout&gt;
  
  
  
  
          &lt;android.support.design.widget.NavigationView
              xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:layout_gravity="start"
              android:id="@+id/shitstuff"
              app:itemTextColor="@color/black"
              app:menu="@menu/drawermenu"
              /&gt;
  
  
  
      &lt;/android.support.v4.widget.DrawerLayout&gt;
  
  
  
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>My Manifest.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.aaron.waller.angelasoundboard"&gt;
  
  
  
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity
              android:name="com.aaron.waller.angelasoundboard.MainActivity"
              android:label="@string/app_name"&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="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;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>And my styles.xml:</p>
  
  <pre><code>&lt;resources&gt;
  
      &lt;!-- Base application theme. --&gt;
      &lt;style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt;
          &lt;!-- Customize your theme here. --&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;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>Why do I get this error and how can I solve it?</p>
  
  <p>I already tried to change this line:</p>
  
  <pre><code>&lt;style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt;
  </code></pre>
  
  <p>to this line:</p>
  
  <p></p>
  
  <p>but this is not working</p>
  
  <p>This is whole my MainActivity.java:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      public MediaPlayer mp;
      DrawerLayout mDrawerLayout;
      NavigationView mNavigationView;
      FragmentManager mFragmentManager;
      FragmentTransaction mFragmentTransaction;
      public InterstitialAd mInterstitialAd;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          AdView mAdView = (AdView) findViewById(R.id.adView);
          AdRequest adRequest = new AdRequest.Builder().build();
          mAdView.loadAd(adRequest);
  
          mInterstitialAd = new InterstitialAd(MainActivity.this);
          mInterstitialAd.setAdUnitId("ca-app-pub-2859881364147521/9737493693");
          mInterstitialAd.loadAd(adRequest);
          mInterstitialAd.setAdListener(new AdListener() {
              // Listen for when user closes ad
              public void onAdClosed() {
                  // When user closes ad end this activity (go back to first activity)
                  super.onAdClosed();
  
              }
          });
  
          final File FILES_PATH = new File(Environment.getExternalStorageDirectory(), "Android/data/com.aaron.waller.angelasoundboard/files");
  
  
          if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
  
              if (!FILES_PATH.mkdirs()) {
  
                  Log.w("error", "Could not create " + FILES_PATH);
  
              }
  
          } else {
  
              Toast.makeText(MainActivity.this, "error", Toast.LENGTH_LONG).show();
  
              finish();
  
          }
  
  
          ActivityCompat.requestPermissions(MainActivity.this,
                  new String[]{android.Manifest.permission.READ_EXTERNAL_STORAGE},
                  1);
  
  
  
              mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
              mNavigationView = (NavigationView) findViewById(R.id.shitstuff);
  
  
              mFragmentManager = getSupportFragmentManager();
              mFragmentTransaction = mFragmentManager.beginTransaction();
              mFragmentTransaction.replace(R.id.containerView, new TabFragment()).commit();
  
              mNavigationView.setItemIconTintList(null);
  
  
              mNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
                  @Override
                  public boolean onNavigationItemSelected(MenuItem menuItem) {
                      mDrawerLayout.closeDrawers();
  
  
                      if (menuItem.getItemId() == R.id.nav_item_inbox) {
                          FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
                          fragmentTransaction.replace(R.id.containerView, new SentFragment()).commit();
  
                      }
                      if (menuItem.getItemId() == R.id.teilen) {
                          Intent shareIntent = new Intent(Intent.ACTION_SEND);
                          shareIntent.setType("text/plain");
                          shareIntent.putExtra(Intent.EXTRA_SUBJECT, "✶Angela Merkel Soundboard✶");
                          shareIntent.putExtra(Intent.EXTRA_TEXT, "✶Hol dir das Angela Merkel Soundboard mit Merkels besten Sprüchen✶\n\nhttps://play.google.com/store/apps/details?id=com.aaron.waller.angelasoundboard&amp;hl=de");
                          startActivity(Intent.createChooser(shareIntent, "Teilen über..."));
                      }
  
  
                      if (menuItem.getItemId() == R.id.nav_item_inbox) {
                          FragmentTransaction xfragmentTransaction = mFragmentManager.beginTransaction();
                          xfragmentTransaction.replace(R.id.containerView, new TabFragment()).commit();
                      }
  
                      if (menuItem.getItemId() == R.id.instagram) {
                          String url = "https://instagram.com/_u/coding.empire/?r=sun1";
  
                          Intent intent = new Intent();
                          intent.setAction(Intent.ACTION_VIEW);
                          intent.setData(Uri.parse(url));
                          onPause();
                          startActivity(intent);
                      }
  
                      if (menuItem.getItemId() == R.id.freshtorge) {
                          String url = "https://play.google.com/store/apps/details?id=com.penta.games.freshtorgesoundboard&amp;hl=de";
  
                          Intent intent = new Intent();
                          intent.setAction(Intent.ACTION_VIEW);
                          intent.setData(Uri.parse(url));
                          onPause();
                          startActivity(intent);
                      }
                      if (menuItem.getItemId() == R.id.tanzverbot) {
                          String url = "https://play.google.com/store/apps/details?id=com.aaron.waller.tanzverbotsoundboard&amp;hl=de";
  
                          Intent intent = new Intent();
                          intent.setAction(Intent.ACTION_VIEW);
                          intent.setData(Uri.parse(url));
                          onPause();
                          startActivity(intent);
                      }
                      if (menuItem.getItemId() == R.id.elotrix) {
                          String url = "https://play.google.com/store/apps/details?id=com.penta.games.elotrixsoundboard&amp;hl=de";
  
                          Intent intent = new Intent();
                          intent.setAction(Intent.ACTION_VIEW);
                          intent.setData(Uri.parse(url));
                          onPause();
                          startActivity(intent);
                      }
                      if (menuItem.getItemId() == R.id.gronkh) {
                          String url = "https://play.google.com/store/apps/details?id=com.aaron.waller.gronkhsoundboard&amp;hl=de";
  
                          Intent intent = new Intent();
                          intent.setAction(Intent.ACTION_VIEW);
                          intent.setData(Uri.parse(url));
                          onPause();
                          startActivity(intent);
                      }
                      if (menuItem.getItemId() == R.id.dummefage) {
                          String url = "https://play.google.com/store/apps/details?id=com.penta.games.dummefragenet&amp;hl=de";
  
                          Intent intent = new Intent();
                          intent.setAction(Intent.ACTION_VIEW);
                          intent.setData(Uri.parse(url));
                          onPause();
                          startActivity(intent);
                      }
                      if (menuItem.getItemId() == R.id.email) {
                          Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
                                  "mailto", "pentagames.business@gmail.com", null));
                          ;
                          startActivity(Intent.createChooser(emailIntent, "E-Mail senden..."));
                      }
  
  
                      return false;
                  }
  
              });
  
  
              android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar);
              ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.app_name,
                      R.string.app_name);
  
              mDrawerLayout.setDrawerListener(mDrawerToggle);
  
              mDrawerToggle.syncState();
  
  
          }
  </code></pre>
  
  <p>I also tried to change <code>android:theme="@android:style/Theme.Translucent"</code> to </p>
  
  <pre><code>android:theme="@style/AppTheme"
  </code></pre>
  
  <p>but then I get following error:</p>
  
  <pre><code>Error:Execution failed for task ':app:processDebugManifest'.
  &gt; Manifest merger failed : Attribute activity#com.google.android.gms.ads.AdActivity@theme value=(@style/AppTheme) from AndroidManifest.xml:28:13-44
      is also present at [com.google.android.gms:play-services-ads-lite:10.2.0] AndroidManifest.xml:25:182-230 value=(@android:style/Theme.Translucent).
      Suggestion: add 'tools:replace="android:theme"' to &lt;activity&gt; element at AndroidManifest.xml:26:9-28:47 to override.
  </code></pre>
  
  <p>This is the project on GitHub:
  <a href="https://github.com/Penta-Games/AngelaMerkel" rel="nofollow noreferrer">https://github.com/Penta-Games/AngelaMerkel</a></p>