31

build.gradle:

build.gradle

Android build.gradle shows following error

ERROR: ParseError at [row,col]:[65,9] Message: expected start or end tag Affected Modules: app
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
Sreenu
  • 416
  • 1
  • 5
  • 9

24 Answers24

66

I got the same error, and the wrong character was found in the [row, col] position of the AndroidManifest.xml, not build.gradle

Nguyen Pham
  • 661
  • 6
  • 2
15
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent">

For me was because I inserted layout width in the layout view from a xml file.

ali 6e7
  • 161
  • 1
  • 4
  • 3
    Thanks for the answer! You're my savor! Idk why Android Studio throw such an exception without telling which part of the xml getting wrong lol – Teo Aug 18 '21 at 09:25
  • 1
    Damnnnn!!! @ali6e7, I want to upvote your answer 100000000 times but sorry I can't, I was struggling for 3 days and finallllly some testy food bro.......... +1 – Ravi Vaniya Dec 15 '21 at 11:35
12

I got this same error, and finally I found that there is error in Mainfest.xml file

 <service
        android:name=".onboarding.httpserver.HttpService"
        android:exported="false"
        >
    </service>>

you see, there are two >> after /service. which is wrong. After I fix this error, this message is disappear

user946110
  • 137
  • 1
  • 5
10

I got the same error similar one like

Message: expected start or end tag
Affected Modules: app
[row, cal] 17,17

I forget an unnecessary /> characters in Manifest. Try to clean if any one has it.

Samir
  • 6,405
  • 5
  • 39
  • 42
  • can you give an example for I may be getting the same thing, but when I tried that, it just created a different error. – j.hull Feb 04 '19 at 20:13
  • @j.hull main issue is there is some unwanted character in your Manifest try to find it, if the are row and cal on the messages so numbers are given try to see them – Samir Feb 05 '19 at 07:55
7

In my project i have made two mistakes that are

  1. Extra > in manifest file
  2. There are some errors in my XML file as in image enter image description here

so go to Analyse> Inspect Code> to find the problems

Shivam Goel
  • 372
  • 4
  • 9
5

I got a Commented line in manifest file, when i removed the commented line and build the gradle file then the error is solved.

chandan raj
  • 51
  • 1
  • 5
5

I got this error after updating the Gradle version, Manifest file was the same though. However reformatting the code in Manifest fixed it.

Ege Kuzubasioglu
  • 5,991
  • 12
  • 49
  • 85
4

when say [27:15] that means you have an error in that position . go to the 27th line and if you have any wrong character correct it or maybe forget the /> or any little mistake in your manifest.xml

NOTE: some times the Merged Manifest can help you.

Sana Ebadi
  • 6,656
  • 2
  • 44
  • 44
2
Simple answer see any thing by mistakenly added unwanted code in the manifest.xml file.

if manifest.xml file is not visible in the android studio project
Goto project folder choose the manifest.xml file and cross check unwanted or commented code.
2

i added this line twice by mistake:

xmlns:tools="http://schemas.android.com/tools"


 <androidx.constraintlayout.widget.ConstraintLayout     
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
  >
Mina Farid
  • 5,041
  • 4
  • 39
  • 46
1

You're using the wrong comment syntax.

Please remove the # comment from the Manifest file and replace it with <!-- Comment -->.

Vyshnavi
  • 338
  • 3
  • 9
1

check any unwanted characters that are added in the manifest file by mistake. After removing those characters/lines the problem was solved in my working application. check once and happy coding

1

also had the same error. just look at the location [row] at the Manifest file and fix the problem (I had extra ">")

Avital
  • 549
  • 5
  • 15
1

It usually happens when there is mistakenly if you have entered any special character or alphabets or numbers in AndroidManifest.xml file

Here meaning [row,col]:[65,9] error in line number between 64 to 66

In my case it happenen because as I shown in below screen shot

enter image description here

Here meaning [row,col]:[65,9] error in line number between 64 to 66 Hope it helps

Suresh Maidaragi
  • 2,173
  • 18
  • 25
1

In my layout file I accidentally put android:padding="16dp" in data binding layout

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
   android:padding="16dp"  <-----this cause the error in my case
>
.............
..............
..........
</layout>

after removing android:padding="16dp" work fine

d-feverx
  • 1,424
  • 3
  • 16
  • 31
  • 1
    This fix it for me, after adding new fragment, then changing from FrameLayout to layout, removing attributes in layout fix it for me (layout only need xmlns attributes). So, if you have xml parser error, check the most recent change from added or remove things from the xml files. – QuartZ Jul 01 '21 at 22:31
1

for me, I got this error when I forgot to add

xmlns:android="http://schemas.android.com/apk/res/android"

in my XML layout

jenos kon
  • 504
  • 4
  • 7
1

For me it's fixed when I am deleted these 2 lines.You should delete width and height

It did fixed for me when I do that. Hope you will solve with this answer.

1

You can easily find these issues with Analyse -> Inspect code.

enter image description here

S. Gissel
  • 1,788
  • 2
  • 15
  • 32
0

In manifest file I commented like

/* something i wrote here
*/

When i deleted this commented line then it was synced and run properly.

ranojan
  • 819
  • 8
  • 11
0

It seems like those kind of errors are general and even if they pinpoint the location of the error, they don't mention in which file the error occurs.

A good way to resolve this error is to check inside the latest .xml files you modified.

stavros.3p
  • 2,244
  • 6
  • 20
  • 37
0

The common steps to spot and fix the error are:

  1. Check what files have been changed in this commit.
  2. Go through each file and check [row,col] or [row-1] position.
  3. Find out which file caused the error and fix it.

In my case the error was

ParseError at [row,col]:[2,6]
Message: The processing instruction target matching "[xX][mM][lL]" is not allowed.

I spotted the error in my drawable/background.xml file which looked like this:


<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:inset="@dimen/card_view_corner_radius">
    <shape android:shape="rectangle">
        <corners android:radius="@dimen/card_view_corner_radius" />
        <solid android:color="?attr/colorActionDialogBackground" />
    </shape>
</inset>

Error: the first line was empty.

Fix: remove the first empty line, so the first line in the xml file should be <?xml version="1.0" encoding="utf-8"?>

Sergio
  • 27,326
  • 8
  • 128
  • 149
0

Just Replace The ic_launcher_Background and ic_launcher Foreground with the correct Code..

Also Check with the Midmap Images if they have some kind of mistake in the XML Code and Replace them with the Correct Code..

I Will Provide the More Detailed Answer With XML Complete Code If Anyone Finds It Useful...

Faran
  • 59
  • 1
  • 6
0

I'm using the Firebase Remote config and i found there's issue with locally stored xml for remote_config, "remote_config_local.xml" value json.

Soft Code
  • 49
  • 5
0

It is a late reply, but it may help others. I faced the same issue, and I resolved it by replacing <activity android:name=".Palmsdetail"></activity> in AndroidManifest.xml with <activity android:name=".Palmsdetail"/> the warning is removed and compiled successfully. Only by closing the tag with /> helped.

Sajidkhan
  • 608
  • 7
  • 16