Androidmanifest xml does not exist or has the wrong root tag

After I renamed the directory app/src/main

to app/src/bk

using the rename feature in Android Studio, I get the following error:

Androidmanifest xml does not exist or has the wrong root tag

I've already tried all the answers from here . Unfortunately none of them worked. I also looked at the problem report .

Is there a way to make this work?

At the moment of copying the directory bk

and renaming it into the main

error disappears and I can create the application.

+3


source to share


4 answers


I solved this by re-importing the project. It will automatically sync the project with the Gradle files. This can also be done by clicking Gradle File Sync Project in Android Studio.



+5


source


I think its not allowed to rename app / src / main

The commented thing will never happen, because when we sync the project with the cradle, it by default replaces main

How can I change my main problem in any other problem, it cannot identify the manifest. so I am specifying the path to the manifest in gradle.build.

You can create a project if you add it to your Android build.gradle.

sourceSets {
            main {
                manifest.srcFile 'src/bk/AndroidManifest.xml'
            }
        }

      



and I got warnings like this.

Error:(33, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(24, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:(22, 23) No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher').
Error:(23, 24) No resource found that matches the given name (at 'label' with value '@string/app_name').

      

As per the warnings, the app cannot find drawables / strings associated with it as we are showing the path to the manifest indirectly.

Maybe I'm wrong. I am adding my assumptions according to my knowledge.

+1


source


Changing the folder name will change the path to the AndroidManifest.xml file. You need to make sure you are pointing to the correct file in Project Structure -> Modules -> [Correct module] -> Android -> manifest file.

+1


source


In my case the .gradle installation is empty

in contain

include ':app'

      

This line indicates that this is an application, if a module than add

include ':module_name'(if not present)

      

after that Sync Gradle file using Sync_now or sync button

thank

+1


source







All Articles