5

I just created a blank activity from File> New> Activity. Its MainActivity.java is editable, same for menu_main.xml, but the activity_main.xml layout file cannot be opened. There is no error message, no sign that anything is happening at all, nothing. I also tried removing the activity and creating it again.

Android Studio is updated to the latest version (1.2.1.1) and I tried opening and closing it. I'm running it on Mac OS X 10.10.3 and the file exists on the file system where the IDE says it is.

Has anyone ever had this problem?

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

EDIT 2 : my build.gradle

 apply plugin: 'com.android.application'
 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'), 'proguard-rules.pro'
 }
 }
 }
 dependencies {
 compile fileTree(dir: 'libs', include: ['*.jar'])
 compile 'com.android.support:appcompat-v7:22.1.1'
 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'
 }
 }
ppreetikaa
1,2632 gold badges16 silver badges23 bronze badges
asked May 13, 2015 at 0:42
5
  • I have had this issue after updating. Have a look at your gradle and and make sure you download the latest SDK that match your gradle Commented May 13, 2015 at 0:48
  • Okay then I am assuming you have not downloaded the latest SDK for the buildToolsVersion "22.0.1". You need to go to your SDK manager and download the latest version and tools. Commented May 13, 2015 at 0:53
  • They are already downloaded and installed. Commented May 13, 2015 at 0:57
  • Go down to extras and see if the support library is 22.1.1 Commented May 13, 2015 at 0:58
  • It wasn't, but I just upgraded it and the same thing happens. I just saw a couple of available updates and I'm installing them right now. Commented May 13, 2015 at 1:04

4 Answers 4

2

I'm guessing the problem is maybe in the selected preview API or device. Check out this toolbar in the preview.

enter image description here

answered Jun 16, 2015 at 7:59
Sign up to request clarification or add additional context in comments.

Comments

1
  1. Please clean & build you project.
  2. Reload xml file go to src->main->res->layout->activity_main.xml.
answered May 13, 2015 at 5:18

Comments

0

I had the same problem. Rebuild, clean, restart mac, reinstall Android Studio, install different Android Studio versions... nothing worked.

Then I found out that the problem was gradle, not Android Studio. In gradle-wrapper.properties I changed the version from 3.3 to 3.5:

distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

This fixed the problem for me.

answered May 3, 2017 at 8:40

Comments

0

If any other project is open in any other window then close it. Now close current project too. Open that project on which you intend to work, first. You'll be good to go.

answered Jun 22, 2017 at 21:13

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.