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.
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.
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?).
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.
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
.
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