root element must be well-formed-android manifest - android

**my manifest file the error is listed below i think it has something to do with the repeated manifest side by side i can't fix it **
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.BinaryRelics"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="20" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Homescreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Arcademode"
android:label="#string/title_activity_arcademode" >
</activity>
</application>
The error is on this line below notice how the 2 manifest tags are next to each other if i delete the first one it says that the application must be a direct child of the manifest if i delete the 2nd one it moves the error to the next line of code
</manifest><manifest xmlns:android="http://schemas.android.com/apk/res/android" >
<application>
<activity
android:name="com.BinaryRelics.Arcademode"
android:label="#string/title_activity_arcademode"
android:parentActivityName="com.BinaryRelics.Homescreen" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.BinaryRelics.Homescreen" />
</activity>
</application>
</manifest>>>>>>>> Added

Why do you have two manifests and two applications defined? You may get away with two applications (I've never tried) but you can have only one root node and it must be 'manifest'
Delete the entire line in the middle
</manifest><manifest xmlns:android="http://schemas.android.com/apk/res/android" >
From the second defined application node take the <activity ...> ... </activity> out and move it inside the the first defined application.
Then delete the left over <application></application> from the end.

Related

Elements not allowed here in android manifest file

I made a new project in Android studio, and this is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cro.perger.rajcica" >
<application
android:allowBackup="false"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name=".rajcica" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
When I build my file I get few gradle errors, and I get this debug/manifest file open:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cro.perger.rajcica"
android:versionCode="10"
android:versionName="2.0.1" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="23" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name="cro.perger.rajcica.rajcica" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I get this errors:
URI not registered
element not allowed for (versionCode, versionName, icon, allowBackup, theme, supportsRtl)
Don't know how to resolve this, because many of this attributes are deleted from my manifest file, but not from debug/manifest file :(
Please help
If you removed those lines from the manifest, but they are still in your debug, then it sounds like your manifest is in the wrong folder. Something changed in your directory structure maybe and you did not realize or intend for that to happen.
Get the manifest in the right folder and make sure that you are editing the correct one.
See this related post: Why is Android Studio reporting "URI is not registered"?
It also could be that you are setting them in your build.gradle file - check there.

/MyFirstApp/AndroidManifest.xml: Element type "activity" must be followed by either attribute specifications, ">" or "/>"

I messed up the xml file while making googles example myfirstapp with an actionbar. Please help. I am a n00b. Here is the full code for the xml file.
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity
android:name=".DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.myfirstapp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.myfirstapp.MainActivity" />
</activity>
</application>
</manifest>
You're missing a closing </activity> for the first activity, it looks like. And the opening xml declarations:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="<your package>"
android:versionCode="1"
android:versionName="dev">
...
Check out the docs on the Manifest: http://developer.android.com/guide/topics/manifest/manifest-intro.html

The markup in the document preceding the root element must be well formed

Error : The markup in the document preceding the root element must be well-formed. How do I correct it ?
I have just started using eclipse and am building myfirstapp as per the instructions on developer.android.com.
<<<<<<< Original
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.myFirstApp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myFirstApp.MainActivity" />
</activity>
</application>
</manifest>
=======
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
<application>
<activity android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity">
<meta-data android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity" />
</activity>
</application>
</manifest>
>>>>>>> Added
You need to remove the '<<<<<<< Original', the '=======', and the '>>>>>>> Added'. Those were most likely put there by a merge tool.
Make sure you keep the '' at the top of the file. For the rest, I don't know which parts from the original you want (the part at the top) and your new entries (below the '=======').

AndroidManifest.xml is getting corrupted when a new activity is created

When i create a new activity for my project, my new activity has errors, i think they are related to the androidmanifest.xml which get some weird lines at start and at end.
This are the lines that eclipse says that has errors
<<<<<<< Original
, >>>>>>> Added
And this is the entire androidmanifest.xml
<<<<<<< Original
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="moran.jonathan.pizzeria"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="moran.jonathan.pizzeria.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="moran.jonathan.pizzeria.Menu"
android:label="#string/title_activity_menu" >
</activity>
</application>
</manifest>
=======
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
<application>
<activity android:name=".Menu"
android:label="#string/title_activity_menu"
android:parentActivityName="moran.jonathan.pizzeria.MainActivity">
<meta-data android:name="android.support.PARENT_ACTIVITY"
android:value="moran.jonathan.pizzeria.MainActivity" />
</activity>
</application>
</manifest>
>>>>>>> Added
What could be happening?
Thanks in advance
EDIT WITH USEFUL INFO:
Never try to create an activity called Menu, as it seems to be some kind of reserved word and this is why this problem appears
This is because you have merged a conflicted file in git. Remove those lines and remove the repeat code and commit again:
<<<<<<< Original
// (1) this is your original Manifest code
=======
// (2) this is the new code.
>>>>>>> Added
NOTE: Either remove (1) or (2) depending on you need. and remove the extra lines
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="moran.jonathan.pizzeria"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="moran.jonathan.pizzeria.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="moran.jonathan.pizzeria.Menu"
android:label="#string/title_activity_menu" >
</activity>
</application>

Application package 'AndroidManifest.xml' must have a minimum of 2 segments

I read this:
Error in AndroidManifest.xml "must have a minimum of 2 segments" but there is no solution.
Its happen after I change the name of the project by refactor->rename (instead com.example.my app to myapp only) and after that I change the name also in the manifest.
Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="save_money"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="save_money.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="save_money.Article"
android:label="#string/title_activity_article" >
</activity>
<activity
android:name="save_money.HashmalActivity"
android:label="#string/title_activity_hashmal" >
</activity>
<activity
android:name="save_money.ImageAdapter"
android:label="a" >
</activity>
<activity
android:name="save_money.SavedItems"
android:label="פריטים שמורים" >
</activity>
<activity
android:name="save_money.Screen2HashmalActivity"
android:label="עלות צריכה" >
</activity>
<activity
android:name="save_money.SelectArticle"
android:label="בחר מאמר" >
</activity>
</application>
</manifest>
What it means is the package declaration in your manifest must have at least two portions separated by a period (.). Instead of just saying package="save_money", change it to package="com.save_money". That should remove your error. Likewise, everywhere you specify the name of an activity, you also need to update it there. Best of luck!
My guess is you need to have a minimum of 2 segments for your package name.
So instead of package="save_money Try package="me.save_money" or whatever you want.

Categories

Resources