Cannot read packageName from AndroidManifest.xml

前端 未结 14 1081
情歌与酒
情歌与酒 2020-12-15 19:52

I have errors in my android manifest file:

Error:Cannot read packageName from C:\\Users\\brandon\\AndroidStudioProjects\\MineDodge2\\app\\src\\main\\AndroidM         


        
相关标签:
14条回答
  • 2020-12-15 20:12

    check your manifest file should be at-> \android\app\src\main\AndroidManifest.xml

    otherwise android can't find the package name in Manifest file from a specific location

    0 讨论(0)
  • 2020-12-15 20:13

    My problem was that I was trying to convert an old Eclipse project to Android Studio project where the manifest file is expected to be on a different location (along with other files). Specifically project\app\src\main

    0 讨论(0)
  • 2020-12-15 20:14

    The error is really simple, and I'm rather dissapointed with the stack community to not have found it till now.

    < manifest ...
    

    should become

    <manifest...
    

    Basically, remove that extra space. That's what's causing the following error :

    Error:The markup in the document preceding the root element must be well-formed.
    

    Also, the intent-filter used for the MainActivity, must similarly be used for the second activity.

    Hope this issue is resolved.

    0 讨论(0)
  • 2020-12-15 20:14

    why you mentioned <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> twice? Remove any one from those two.

    0 讨论(0)
  • 2020-12-15 20:15

    Thats simply because you either copied an already existing project and its files into your newly created project. Thereby causing Manifest conflict. Because the manifest copied belongs to the other project and its paths.

    you need to recreated a manifest file in your own project file path and possibly manually copy the other project's manifest code into your newly created manifest file.

    0 讨论(0)
  • 2020-12-15 20:18

    I got this error on Unity 2018 and i think it's a bug.

    Fix for me: Add packagename to Android Manifest in Unity project.

    In my project path to manifest: Assets/Plugins/Android/AndroidManifest.xml

    For example i got error when my Manifest file looks like this:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    </manifest>
    

    It generated by Oculus Gear VR plugin by Unity. But it missed package name and must looks like this:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <manifest package="YOURPACKAGENAME" xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    </manifest>
    

    Replace YOURPACKAGENAME to Package Name of your project. It should be in Edit -> Project Settings -> Player -> Other Settings -> Identification -> Package Name and should looks like com.YOURORGANIZATION.APPNAME

    Some peoples wrote, that manifest must looks like this:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <manifest package="${applicationId}" xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    </manifest>
    

    And they wrote that Unity will replace ${applicationId} on package name when build android application, but in my Unity 2018.1.6f1 it doesn't work and i think it's a bug too.

    0 讨论(0)
提交回复
热议问题