I had the following rendering issue on all my layouts when using SDK 22 to preview them.
Error inflating class android.support.v7.widget.Toolbar.
java.lang.NoSuchFieldError: View_theme
In my case , the problem was styles.xml
:
XML with rendering problem:
<resources>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar" />
<!-- Base application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="android:textColorPrimary">@color/primary_text</item>
</style>
</resources>
XML without problem:
<resources>
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar" />
<!-- Base application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="android:textColorPrimary">@color/primary_text</item>
</style>
</resources>
Notice how I had to add @style/
in the parent reference. That seems to solve my problem (after a rebuild).
Question, is this an error on my side, or a bug? Many tutorials don't put it (Including Official Android Page)
Gradle:
compileSdkVersion 22
buildToolsVersion '22.0.1'
minSdkVersion 15
targetSdkVersion 22
classpath 'com.android.tools.build:gradle:1.1.0'
Final Note: I'm not using Toolbar.