Render error in Android Studio 3.0 Layout Editor
I just started learning Kotlin for android development and started an empty project and added an activity. I have added the required gradle dependencies as said in Kotlin docs. By default the xml file of MainActivity contains only a TextView. But when I try to preview the xml in Layout Editor it shows a "Render Error"
Render problem
Failed to load AppCompat ActionBar with unknown error.
Also I'm getting this
The following classes could not be instantiated:
- android.support.v7.widget.AppCompatImageView (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarContainer (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.Toolbar (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.AppCompatTextView (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarContextView (Open Class, Show Exception, Clear Cache)
- android.support.v7.app.WindowDecorActionBar (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarOverlayLayout (Open Class, Show Exception, Clear Cache)
Exception Details java.lang.ClassNotFoundException: android.support.v4.view.TintableBackgroundView
I have tried rebuilding the project and refreshing layout manually. But nothing seems to work.
So what do I do? I'm using Android Studio 3.0 Canary 2 with Kotlin
EDITED:
I have made some progress. I have found that none of my AppCompat Themes are working.
This solution may help you. Modify style.xml from:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
to:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
</style>
I also have this problem, solved as follows: modify the appcompat-v7:26.0.0-beta2
on build.gradle
(modle:app
) to appcompat-v7:26.0.0-beta1
.
Dude I'm also having same issue using Android Studio 3.0, I got an solution by just make some changes in style file under the value folder of res.
Here it is...
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.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>
I have added "Base." in parent to make it work properly!
error is :
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
change :
implementation 'com.android.support:appcompat-v7:26.0.0-beta1'