build.gradle:
Android build.gradle shows following error
ERROR: ParseError at [row,col]:[65,9] Message: expected start or end tag Affected Modules: app
I got the same error, and the wrong character was found in the [row, col] position of the AndroidManifest.xml, not build.gradle
<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.
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
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.
In my project i have made two mistakes that are
Extra > in manifest file
There are some errors in my XML file as in image
so go to Analyse> Inspect Code> to find the problems
I got a Commented line in manifest file, when i removed the commented line and build the gradle file then the error is solved.
I got this error after updating the Gradle version, Manifest file was the same though. However reformatting the code in Manifest fixed it.
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.
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.
You're using the wrong comment syntax.
Please remove the # comment from the Manifest file and replace it with <!-- Comment -->.
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
also had the same error. just look at the location [row] at the Manifest file and fix the problem (I had extra ">")
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
Here meaning [row,col]:[65,9] error in line number between 64 to 66
Hope it helps
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
for me, I got this error when I forgot to add
xmlns:android="http://schemas.android.com/apk/res/android"
in my XML layout
For me it's fixed when I am deleted these 2 lines.
It did fixed for me when I do that. Hope you will solve with this answer.
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"
>
You can easily find these issues with Analyse -> Inspect code.
In manifest file I commented like
/* something i wrote here
*/
When i deleted this commented line then it was synced and run properly.
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.
The common steps to spot and fix the error are:
Check what files have been changed in this commit.
Go through each file and check [row,col] or [row-1] position.
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"?>
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...
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.
I've checked online for a solution tried solutions from this page: Error: Suspicious namespace and prefix combination [NamespaceTypo] when I try create Signed APK and also errors in hello world xml but there's no solution. The funny thing is when I try to build a debug of the app or a release for tv and wear everything works well. Error:
(9) Error: Suspicious namespace and prefix combination [NamespaceTypo]
xmlns:app="http://schemas.android.com/tools"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanation for issues of type "NamespaceTypo":
Accidental misspellings in namespace declarations can lead to some very
obscure error messages. This check looks for potential misspellings to help track these down.
1 errors, 0 warnings
Layout file part of the code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
A solution to this is very helpful
Instead of what you have on line 3:
xmlns:app="http://schemas.android.com/tools"
Use:
xmlns:tools="http://schemas.android.com/tools"
Please change your namespace
xmlns:app="http://schemas.android.com/tools"
to
xmlns:app="http://schemas.android.com/apk/res-auto"
Fixed the problem...I had been working on the project using Android Studio version 1.0 and got the problem when I updated to version 1.5.1 So all I did is just getting back to the old version and things were okay, I have no idea why this is the case...
You can reproduce those errors by using the tool Analyse->Inspect code in android studio.
in the xml make sure that
xmlns:app="http://schemas.android.com/apk/res-auto"
and
xmlns:tools="http://schemas.android.com/tools".
If you can write like xmlns:app="http://schemas.android.com/tools" ,you will get an error.
I have got a strange situation when I working on my project.I have just run my application once. Then I changed some "android:margin" properties for my XML files. Then the problem came. I ran the project and it crashed. The log says it comes Resource Not Found Exception. Next I tried to export it but it failed to export. I'll post the log and error dialog below.
What have I done:
I reinstalled everything such as eclipse,ADT and SDK. Not work at all. I'm absolutely sure that the resource exists and stays in right position.**
All useful information is needed.
ps: The resource file that not found is an activity layout xml file--my intro activity and I've found the resource id in my R file.
ps: My friends use the same code as me.They don't have any problem.
here's my layout xml file:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/fl_base_activity"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/iv_base_wallpaper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#color/trans_cc" />
</FrameLayout>
Try re-building your project , If that doesn't work , delete the 'build' and 'gen' folders of project(you can take a backup elsewhere but remove them from your project folder) and then try running it again.
Let me know if that works.....
I've found why : So stupid fail that there is a resource with no suffix has been add in my project from SVN. It has a same name with correct resource name but without .png, eclipse can't distinguish what's the difference between them. It has no error notice. WTF!
I've got quite weird problem with new AdView creation in layout XML while migrating from old AdMob.
OK.
Product target- Google API 19
Default properties- Google API 8
google play lib is referenced in the project and seems to be dexed and then included into resulting apk (proof is below).
I have the following code in my layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0"
android:orientation="vertical" >
...
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="#string/admob_unit_id"
/>
When I load the layout I've got the exception.
I see the following suspicious things:
I have specially put code which uses AdView BEFORE the XML loading and have no exception there
com.google.android.gms.ads.AdView ad= new com.google.android.gms.ads.AdView(this);
try
{
setContentView(R.layout.ap_map);
}
catch(RuntimeException e)
{
throw e;
}
So, I assume that there is no prob with google play library inclusion itself.
However, when I debugged the exception- I've got an internal exception- NoClassDefFoundException, so it looks exactly like I have google play lib missed
I have weird probs with AdView declaration- if I declare it as google suggest
I've got an error saying that
- error: No resource identifier found for attribute 'adSize' in package MYPACKAGE
So I had to add
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
in the top of the layout declaration to get rid of this
Any ideas? I've read a few related topics here and all of them seems to be related with google play lib absence but it does not seem to be the case
Change :
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
to:
xmlns:ads="http://schemas.android.com/apk/res-auto"
First off forgive me if I posted this question wrong. I've used stackoverflow for many problems but this is the first time I couldnt already find an answer to my problem. So, if I'm doing something wrong please let me know and I'll repost / edit the question.
Now unto business. I've just recently started development w/ the Android SDK and I'm following the basic tutorial from http://developer.android.com/resources/tutorials/hello-world.html#avd
I've gotten up the xml editting part and when I make all the changes to the xml files main.xml and strings.xml this error occurs. Also, when I compile the project, the compilation process generates a main.out.xml file that is empty. I don't know what it is or its purpose.
The error:
[2011-12-30 16:10:02 - Hello Razor] res\layout\main.xml:0: error: Resource entry main is already defined.
[2011-12-30 16:10:02 - Hello Razor] res\layout\main.out.xml:0: Originally defined here.
[2011-12-30 16:10:02 - Hello Razor] C:\Users\Dux69\workspace\Hello Razor\res\layout\main.out.xml:1: error: Error parsing XML: no element found
[2011-12-30 16:10:13 - Hello Razor] Error in an XML file: aborting build.
My project is setup for platform: Android 2.3.3 API Level: 10
I don't know if it makes a difference or not but I'm using my Android Incredible for running/debugging the application not a Android Virtual Device. If there is any more information needed let me know and I'll post it ASAP.
Here are the three code files I'm using:
main.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:text="#string/hello_O" />
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello_O">Baba in the house, Razor Activity!</string>
<string name="app_name">Hello Razor App</string>
</resources>
razorActivity.java
package hello.Razor;
import android.R;
import android.app.Activity;
import android.os.Bundle;
public class razorActivity extends Activity
{
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
I had a similar problem once.
Rebuilding/cleaning the project and restarting Eclipse helped for me.
delete the main.out.xml in project view and re-run as android application
Error message I got:
Error:(43) Error parsing XML: no element found
and
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
Solution: In my case, project activity_main.xml is initiated with the code
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.batvibes.battybirthday.Main1Activity">
and I forgot the below end tag.
</android.support.constraint.ConstraintLayout>
Disclaimer: I am totally new to android development. My suggestion, please check all tags opening and closing and go to next step of debugging.
Try to end your Main or Sub Layout like:
</LinearLayout>