“AndroidManifest.xml doesn't exist or has incorrect root tag” Error

喜夏-厌秋 提交于 2020-08-19 11:18:36

问题


I am new to AndroidStudio AND Gradle.

I imported a project from eclipse, created a module, and tried to run the project, but I got this error:

AndroidManifest.xml doesn't exist or has incorrect root tag

I have been looking at this previous solution for it: How to build an android library with Android Studio and gradle?

But that solution is WAY too advanced for me.

Could someone please help me understand in simpler terms what is going wrong and how I can fix it?

Thank you!

Update after one of the answers:

These are the options I have under the build menu:


回答1:


clicking on Sync project with Gradle files button will solve your problem.

That button is under File section on Android Studio 3.6.1




回答2:


  1. Close your Android Studio
  2. Goto C:\Users\user\.AndroidStudioX.X\system and DELETE the cache folder
  3. Launch the Sndroid Studio
  4. Goto Build (menu) -> Clean Project when done click the Build (menu) again and click rebuild project.

That should solve the problem.




回答3:


For me clicking on Sync project with Gradle files button did not solve the problem alone.

After Syncing project with Gradle files, I explicitly had to invalidate the cache and restart studio. Only after this action, the red cross-mark over configuration disappeared and everything started working.




回答4:


Every Android project needs a file called AndroidManifest.xml to tell Android about itself. Either your project doesn't have one, or it's not in the place that Android Studio expects it to be. Try to find it, and move it to the root folder of the project.




回答5:


1.Check whether the manifest file is there or not.

2.If it is there, check whether the package name is correct or not..

3.If you project has small number of classes, then you create new project in android and then copy paste your code from eclipse. It will be simple. But it is recommended only for small project.

And finally click 'Sync' in the Gradle file. Followed by Rebuilding the project will do a trick.




回答6:


Go to C drive click User then select your android studio folder then select System find Cache folder and delete this folder before doing this close your android Studio.It will surely work.




回答7:


In my case, my android project got corrupted and some of the files were showing characters, binary numbers, etc. I tried the following solutions

  1. Invalidate & Restart
  2. Rebuild Project
  3. Sync with Gradle File

But none of the above solutions worked for me.

Then I just deleted the cache folder under C:\Users\username\.AndroidStudio3.6\system

and all the invalid characters disappeared and the actual contents of all the files were displayed. This solution worked for me.




回答8:


Click on File > Invalidate Cache/Restart, and that's it. Your project should start working.




回答9:


In my case the Manifest file seemed to be corrupted or maybe its meta data. Trying to open it in Android Studio will show some characters that you see when opening a binary file with a text editor, for ex. Anyway, my project is under Git, so I just deleted it and restored it back, problem fixed.



来源:https://stackoverflow.com/questions/34270034/androidmanifest-xml-doesnt-exist-or-has-incorrect-root-tag-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!