I'm receiving this error message in the Android Preview Designer as "Rendering Problems". I'm using API 22 to render and migrating to the new API support v4:22.1+ and v7:22.1+.
Rendering Problems
Exception raised during rendering: View android.support.v7.widget.Toolbar not created with the right context
Scenario:
Compile section:
compile 'com.android.support:support-v4:22.1.+'
compile 'com.android.support:appcompat-v7:22.1.+'
Toolbar
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:elevation="4dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/Theme.AppCompat"
/>
The error was caused because I had to remove in the Toolbar layout, the "app" section and change 'app:' by 'android:'.
Remove:
xmlns:app="http://schemas.android.com/apk/res-auto"
Replace:
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/Theme.AppCompat"
For:
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:popupTheme="@style/Theme.AppCompat"
I solved this problem by Downgrading API level from 22,21 to 20 as shows in below image
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With