2

I am getting this error in android studio

Render problem

Failed to load AppCompat ActionBar with unknown error.

Failed to instantiate one or more classes

    The following classes could not be instantiated:
- android.support.v7.widget.ActionBarContainer (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)
 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 

So I found two solutions but, what's the difference? I don't want to downgrade and possibly run into future problems and I don't know what the other solution(2) does.

Solution 1 - Downgrade

Render error android studio failed to load appcompat action bar, even after matching library versions

Solution 2 - Not sure what it does

Failed to load AppCompat ActionBar with unknown error?

P.S New to android studio

3 Answers3

4

As Dona said. But no need to change the gradel, Just change the styles xml-file from:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

to this:

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Don't know why, but it work

Codey
  • 460
  • 1
  • 8
  • 23
2

com.android.support:appcompat-v7:28.0.0-alpha3 has few bugs

change

implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'

to

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'

or In your styles xml-file change this:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

to this:

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

it will work

Devil10
  • 1,853
  • 1
  • 18
  • 22
Dona
  • 21
  • 8
2

Usuallly it solves with the correction of the following code:

com.android.support:appcompat-v7:28.0.0-alpha3

to

com.android.support:appcompat-v7:28.0.0-alpha1

but for other persons (like me) is not the case, so what else? there's a problem with the theme of the app that makes some kind of error at the moment of previsualization. To fix that, I've made this: (Image)

https://yadi.sk/i/QCM_pCvvAcajOw

Changing the theme of the document everything got solved.