Reputation:
suddenly my android studio damaged and it cannot to open a XML of layout. When I double click on layout xml it doesn't show in code editor also when I drag and drop xml file from project path android studio cannot to show it please help me thanks!
Upvotes: 6
Views: 9260
Reputation: 101
N.B: It's not a permanent solution. But a quick hack.
For those, whose nothing is working. right-click on the file. click show in explorer. then drag-drop the file to android studio.
Upvotes: 0
Reputation: 11259
Ok It was very stupid, and I had not coded in Android Studio for a while, but:
The reason while I could not open the .xml file (loading non stop) was that I was using the image view (two little triangles that look like mountains) instead of the code view (4 dashes), switch in the top right corner above "Loading...". I hope this would be helpful.
Upvotes: 0
Reputation: 17
Please check your gradle-wrapper.properties file and make sure proper url is given
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
Upvotes: 0
Reputation: 25
Click File -> Invalidate Caches / Restart -> Invalidate caches And Restart.
Upvotes: 0
Reputation: 11
Refresh your Gradle project.
I tried to invalidate and restart, disable Android Support plugin, rebuild project and still got the issue.
I tried Refreshing Gradle project and problem solved.
Upvotes: 1
Reputation: 2395
Go to plugins -> Android support
and disable this. Restart Android studio and enable the plugin again.
Worked for me.
Upvotes: 4
Reputation: 43
I was getting the same issue because I enabled Proguard in my debug build. After disabling that, I am able to open layout files in my project. Do the below in your app gradle file.
debug
{
minifyEnabled false
}
Hope it would help someone.
Upvotes: 1
Reputation: 41
It could be a keymap conflict. I set the double click for a plugin, and that was the cause.
Upvotes: -1
Reputation: 4049
I had the same issue. Be sure that your XML is valid (with another text editor), then clean project and rebuild it. Wait for the new project indexing process finish, and it should work.
If not, try by restart AS with invalidate cache.
Upvotes: 1