First of all, I researched alot and this question is not a duplicate of Rendering Issue in Android Studio its answer doesn't fix my problem (i already have the same configuration that is in its answer). Secondly I tried cleaning project, rebuilding project, running gradle sync too. Issue still persist.
After starting a new project, i used to load a template basic activity but the layout xml files are actually not rendering.
Error:
It says Failed to instantiate one or more classes
inside that i see
The following classes could not be instantiated:
- android.support.design.widget.CoordinatorLayout (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.AppBarLayout (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE.
If this is an unexpected error you can also try to build the project, then manually refresh the layout.
Exception Details
java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener
Copy stack to clipboard
my styles.xml file is:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
<item name="floatingActionButtonStyle">@style/Widget.Design.FloatingActionButton</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
</resources>
My gradle is using this dependency: and compilation and target sdk version is 28
implementation 'com.android.support:appcompat-v7:28.0.0'
Right now it looks like:
EDIT 1: So now at this point, i tried many things and found myself that the rendering issue is only in SdkVersion 28. When I use
android {
compileSdkVersion 27
defaultConfig {
targetSdkVersion 27
...
}
...
}
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
...
}
It doesn't appear to be, so I want to investigate what's wrong with sdk version 28? I mean like whenever you make a project you get default config for version 28 and when i try this above snippet i still get warning that v27 is older, why? if v28 not stable enough then why is it default? I don't understand I want some useful answer for why this is!
Thanks everyone who used time to read my question.