-1

Exception Details 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:34)   at android.support.design.widget.CoordinatorLayout.(CoordinatorLayout.java:184)   at android.support.design.widget.CoordinatorLayout.(CoordinatorLayout.java:178)   at java.lang.reflect.Constructor.newInstance(Constructor.java:422)   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)   at android.view.LayoutInflater.inflate(LayoutInflater.java:492)   at android.view.LayoutInflater.inflate(LayoutInflater.java:394) Copy stack to clipboard

My acivity_main.xml is :

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_main" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:src="@android:drawable/ic_dialog_email" />

my styles.xml is

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

s.g
  • 57
  • 1
  • 7
  • 3
    Possible duplicate of [You need to use a Theme.AppCompat theme (or descendant) with this activity](http://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity) – N J Oct 15 '16 at 07:56
  • This may be issue with the style selected please [see this..](http://stackoverflow.com/questions/33959478/rendering-issue-in-android-studio) – Emdad Hossain Oct 15 '16 at 07:57
  • i have tried its not working .. @EmdadHossain – s.g Oct 15 '16 at 08:23
  • hello all the prblem is fixed now.. change your style parent to "Theme.AppCompat.Light.NoActionBar" instead of "Theme.AppCompat.Light.DarkActionBar" it worked for me.... – s.g Oct 16 '16 at 06:52

1 Answers1

0

Logcat output is clear, Set your AppTheme to inherit from Theme.AppCompat.

<style name="AppTheme" parent="@style/Theme.AppCompat>
</style>

You can find this in values file and you can also check manifest file to see what theme your are imposing.

Nayan Srivastava
  • 3,655
  • 3
  • 27
  • 49