I got this error on Android Studio (AS):
How I got it:
I created an AS Project from scratch and everything was fine.
Then a popup showed up, and (if I recall correctly) was saying something like: "Android Framework detected
". I pressed "Yes' and some changes happened to the project/module. And after that I got the above error
Edit:
In my case the problem was not Gradle
related. It had to do with IntelliJ
/Android Studio
configuration, an .iml
file in particular.
I realized that after reading this informative post here.
Happened to me. Found that i had wrongly opened the parent folder of the actual project in Android Studio.
On Android Studio v0.8.2 clicking on
Sync project with Gradle files
button solved my problem.update
Thanks to the comment of jaumard. If the
Sync project with Gradle files
it's not visible you have to open the Gradle panel and click sync icon on top the toolbar.Hope it helps :)
I ran into a similar problem. Looks like my .../src directory for whatever reason moved under my .../lib directory. I moved it out of the /lib directory. Now both /lib and /src are at the same level. After a couple of clean rebuilds and restarts of Android studio everything is back to normal. My emulator started up fine.
You might want to check your directory structure. Compare the directory structure with a working project. You might be able to see the difference.
I had this problem with a multi-module project when I renamed the app module. In my case to solve the problem I had to manually update the app module name in the project's settings.gradle file (Android Studio didn't update that value)
In my case, it was my AndroidManifest.xml file, it was all messed up due to a new library that I added in my build.gradle. So I took the AndroidManifest.xml from my latest commit on Git and I replaced it the current one, and also my settings.gradle was empty so I added include ':app'.
Hope it helps, and happy coding !
Just call (in any case) File -> Invalidate Caches and Restart....