Reputation: 11
So I just installed Android Studio and started following the "Build your first app" Guide on Android's Developer Site. I followed there guide by creating a simple, empty app, with nothing but "Hello World" text in the middle of the screen.
While running the app on the emulator it works fine, but when I look at the Blueprint in the Layout Editor, it is empty. It should show the "Hello World" TextView in the center as well as the show the constraints.
I get these messages below:
`Render Problem
Failed to load AppCompat ActionBar with unknown error.
Tip: Try to refresh the layout.`
...AND
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. E
xception Details java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener
So I've read that it might have something to do with the appcompat version, and I see that there is a version in my build.gradle
file that looks like this:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
And that I should look at the appcompat-v7
folder in my sdk folder, and see which is the highest version I have in there.
-It's version 26.0.0-alpha1
So would the solution be to place a folder with 28.0.0-alpha3
in my appcompat-v7
folder within my SDK dierctory? And where would I get that?
Can someone let me know if I understand what the problem is here...
The appcompat version in the build.gradle file that the app will be built with, differs from the verion the SDK is using to display the app in the Layout Editor?
Thanks
Upvotes: 0
Views: 181
Reputation: 185
In your Gradle Module: App
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.zumoappname"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.1.2'
you will see something similar to this, the number by compileSdkVersion 23
must correspond with the number by 'com.android.support:appcompat-v7:23.4.0'
so as you can see in this example i used 23
Upvotes: 0