Android Studio: Android Manifest doesn't exist

2019-01-07 06:30发布

问题:

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.

回答1:

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 :)



回答2:

Just call (in any case) File -> Invalidate Caches and Restart....



回答3:

In my case:

settings.gradle file was empty. I added defualt code:

include ':app'

Then I clicked

Then project start works.



回答4:

What helped for me was:

  • delete .gradle/ folder
  • delete .idea/ folder
  • delete ****.idea*** file
  • reopen Android Studio
  • import from gradle as Android Studio then suggests


回答5:

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.



回答6:

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.



回答7:

Moving my AndroidManifest.xml to PROJECT_NAME/src/main fixed the issue.



回答8:

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



回答9:

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)



回答10:

Happened to me. Found that i had wrongly opened the parent folder of the actual project in Android Studio.



回答11:

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 !