Java – Layouts cannot be opened in Android Studio

Layouts cannot be opened in Android Studio… here is a solution to the problem.

Layouts cannot be opened in Android Studio

I just created a blank activity from “file” > “new” > “activity”. Its MainActivity .java is editable, as is menu_main.xml, but activity_main.xml layout files cannot be opened. No error messages, no signs that anything is happening, nothing. I also tried deleting the activity and recreating it.

Android Studio is updated to the latest version ( and I tried turning it on and off.
I ran it on Mac OS X 10.10.3 and the file exists in the file system indicated by the IDE.

Has anyone encountered this issue?

EDIT: Just tried restarting my computer and the same thing happened.

Edit 2: My build.gradle

apply plugin: ''

android {
        compileSdkVersion 22
        buildToolsVersion "22.0.1"

defaultConfig {
            applicationId "ca.etsmtl.gti785.telebama"
            minSdkVersion 16
            targetSdkVersion 22
            versionCode 1
            versionName "1.0"
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), ''

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile ''

testCompile 'junit:junit:4.12'
        testCompile('org.robolectric:robolectric:3.0-rc2') {
            exclude group: 'commons-logging', module: 'commons-logging'
            exclude group: 'org.apache.httpcomponents', module: 'httpclient'


I’m guessing the problem might be with the selected preview API or device. View this toolbar in preview.

enter image description here

Related Problems and Solutions