title: Theme Material Android: You need to use a Theme.AppCompat theme (or descendant) with the design library
body: <p>I got error message like:</p>
  
  <pre><code>java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
      at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:36)
      at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:192)
      at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:186)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
      at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
      at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
      at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
      at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334)
      at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345)
      at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
      at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
      at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
      at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
      at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
      at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
      at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
      at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
      at com.android.tools.idea.rendering.RenderTask.lambda$inflate$72(RenderTask.java:659)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>for temp.xml (layout) like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;android.support.v4.widget.NestedScrollView
          android:layout_width="match_parent"
          android:layout_height="490dp"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical" /&gt;
      &lt;/android.support.v4.widget.NestedScrollView&gt;
  
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>manifest:</p>
  
  <pre><code> &lt;application
  
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
  </code></pre>
  
  <p>styles:</p>
  
  <pre><code>&lt;style name="AppTheme" parent="android:Theme.Material.Light"&gt;
          &lt;!-- theme customizations --&gt;
          &lt;item name="android:windowActionBar"&gt;false&lt;/item&gt;
          &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
      &lt;/style&gt;
  </code></pre>
  
  <p>and gradle app:</p>
  
  <pre><code>android {
      compileSdkVersion 24
      buildToolsVersion "24.0.1"
  
      defaultConfig {
          applicationId "bippo.co.id.bidapplication"
          minSdkVersion 21
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  :
  :
  </code></pre>
  
  <p>I have read <a href="https://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity">You need to use a Theme.AppCompat theme (or descendant) with this activity</a>:</p>
  
  <ol>
  <li>NO extends to <code>ActionBarActivity</code>, but the class extends to <code>FragmentActivity</code></li>
  <li>I want to use Theme Material Light</li>
  </ol>
  
  <p>please share what should I do :)</p>
  
  <p>@Michael Spitsin:
  I have tried different theme foreach activity (on manifest):</p>
  
  <pre><code>&lt;application
  
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"&gt;
  
          &lt;activity
              android:name=".MainActivity" android:theme="@style/AppTheme"&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=".FormLogin" android:theme="@style/AppTheme" /&gt;
  
          &lt;activity android:name=".FormRegister" android:theme="@style/AppTheme" /&gt;
  
          &lt;activity android:name=".FormAccountView" android:theme="@style/AppTheme" /&gt;
  
          &lt;activity android:name=".FormSearch" android:theme="@style/AppTheme" /&gt;
  
          &lt;activity android:name=".FormItemView" android:theme="@style/CoordinatorTheme"/&gt;
  
          &lt;activity android:name=".Temp" android:theme="@style/CoordinatorTheme" /&gt;
  
      &lt;/application&gt;
  </code></pre>
  
  <p>and sytles + styles-21:</p>
  
  <pre><code>&lt;!-- your theme inherits from the material theme --&gt;
      &lt;style name="AppTheme" parent="android:Theme.Material.Light"&gt;
          &lt;!-- theme customizations --&gt;
          &lt;item name="android:windowActionBar"&gt;false&lt;/item&gt;
          &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;!-- coordinator layout. --&gt;
      &lt;style name="CoordinatorTheme" parent="Theme.AppCompat.Light"&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;
  </code></pre>
  
  <p>but I still got the msg error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
      at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:36)
      at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:192)
      at android.support.design.widget.CoordinatorLayout.&lt;init&gt;(CoordinatorLayout.java:186)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
      at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
      at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
      at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
      at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334)
      at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345)
      at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
      at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
      at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
      at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
      at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
      at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
      at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
      at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
      at com.android.tools.idea.rendering.RenderTask.lambda$inflate$72(RenderTask.java:659)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>