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.
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 :)
Just call (in any case) File -> Invalidate Caches and Restart....
In my case:
settings.gradle file was empty. I added defualt code:
include ':app'
Then I clicked
Then project start works.
Double check that under project structure / module / Manifest file it points to the correct manifest file in your code and not the one in generated sources.
This is true for both Android Studio and Intelli J. Sometime when you import project from existing sources it prefer the manifest file inside the generates sources directory.
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.
Moving my AndroidManifest.xml
to PROJECT_NAME/src/main
fixed the issue.
I had the same errormessage and noticed I had 2 MYPROJECTNAME.iml files, but with a different casing of MYPROJECTNAME. I created this situation after checking out from SVN the project into a directory with the casing error.
Just throw away the IML file with the wrong casing, after saving the content of both and use the content that works
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)
Happened to me. Found that i had wrongly opened the parent folder of the actual project in Android Studio.
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 !