Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 579
Sidharth Anil Avatar asked May 28 '17 03:05

Sidharth Anil


People also ask

What does render problem mean in Android Studio?

rendering problem caused your designer preview used higher API level than your current android API level. Adjust with your current API Level. If the API level isn't in the list, you'll need to install it via the SDK Manager.

What is rendering in Android Studio?

UI Rendering is the act of generating a frame from your app and displaying it on the screen. To ensure that a user's interaction with your app is smooth, your app should render frames in under 16ms to achieve 60 frames per second (why 60fps?).

Where is the layout editor in Android Studio?

To make room for the Layout Editor, hide the Project window. To do so, select View > Tool Windows > Project, or just click Project on the left side of the Android Studio screen. If your editor shows the XML source, click the Design tab at the top right of the window.


2 Answers

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> 
like image 197
Alex.Z Avatar answered Sep 28 '22 09:09

Alex.Z


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.

like image 20
oreo Avatar answered Sep 28 '22 09:09

oreo