2

I've started to delve into app development and I'm following some online tutorials and I've come across this rendering issue. Whenever I select any theme other than AppTheme.NoActionBar I get an error along the following lines.

The following classes could not be instantiated: - android.support.design.widget.CoordinatorLayout (Open Class, Show Exception, Clear Cache) - android.support.design.widget.AppBarLayout (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE 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:178)   at android.support.design.widget.CoordinatorLayout.(CoordinatorLayout.java:172)   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

Look over all the solutions suggested here from changing appTheme in Styles and changing things in the AndroidManifest but nothing seems to work. I'm still receiving rendering problems in my content main.

My Styles.xml:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- 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" />

My AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

This is my default XMLs, but even the changes suggest had no avail. Its been around 2 months and I still haven't gotten past this...

Community
  • 1
  • 1
Alkarin
  • 464
  • 7
  • 20
  • Possible duplicates: http://stackoverflow.com/questions/21331836/java-lang-illegalstateexception-you-need-to-use-a-theme-appcompat-theme-or-des, http://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity or http://stackoverflow.com/questions/18063395/actionbarcompat-java-lang-illegalstateexception-you-need-to-use-a-theme-appcom –  Nov 02 '15 at 06:03
  • 1
    I have looked at all those answers and I can't find out what I need to do. – Alkarin Nov 04 '15 at 18:38
  • you can try by recreating caches & indexes. Go to File -> Invalidate Caches / Restart.... Maybe this help! – Ock Feb 12 '16 at 11:11

1 Answers1

1

Use something like Theme.AppCompat.Light.NoActionBar. You can set this in your styles.xml found in your resources, res/values/styles.xml.

Orbit
  • 2,985
  • 9
  • 49
  • 106