instead of preview, Android Studio showing only black screen with 'android...ActionBarOverlayLayout' written on it

If problem still not solved after doing things that @Roar RAP mentioned.

Goto: src -> main -> res -> style.xml and add Base. to the style tag parent attribute. It should look like below,

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

This option is also worked for me.


Had the same error as you.

I updated the build.grade file, so that the "compileSdkVersion" matched the version I was running in my emulator. I also updated my "targetSdkVersion" to likewise fit the SDK I was running in my emulator.

Lastly, Android Studio asked me to update the dependencies (underlined with red in the program, so that it matches the targetsdkversion.. the last three lines...)

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '26.0.2'

defaultConfig {
    applicationId "com.example.android.miwok"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
 }
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:27.0.1'
    compile 'com.android.support:support-v4:27.0.1'
    compile 'com.android.support:design:27.0.1'
}`

You have to do two things:

  1. be sure to have imported right appcompat-v7 library in your project structure → dependencies
  2. change the theme in the preview window to not an AppCompat theme. Try with Holo.light or Holo.dark for example.