Trying to test my android shortcuts but I keep getting an error stating that attribute android:shortcutLongLabel not found, and this continues with shorcutShortLabel, shortcutID, etc. Shouldn't make a difference but I am writing the app in kotlin, and am using compileSdkVersion 29.
Trying to add app shortcuts to my project. So I created the shortcuts.xml file and added it to res/xml/shortcuts.xml. I've made sure everything in Gradle was up to date, and have followed Google's documentation down to the dot on adding shortcuts in your app. I assume there is something wrong with either my Gradle or manifest.xml but I don't know what. Also when I hit F2 it says no errors found on this file.
<?xml version="1.0" encoding=utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut android:enable="true"
android:shortcutID="xxxx"
android:icon="#drawable/xxxxx"
android:shortcutShortLabel="#string/xxxx"
android:shortcutLongLabel="#string/xxxxx">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="com.example.test"
android:targetClass="com.example.test.TestIntent/>
</shortcut>
Every time the following happens when I build my project:
AAPT: error: attribute android:shortcutLongLabel not found. AAPT:
error: attribute android:shortcutShortLabel not found. AAPT: error:
attribute android:shortcutID not found.
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 am developing a NativeScript app for android and wish to implement managed configurations as described here: https://developer.android.com/work/managed-configurations.html.
I have tried adding app_restrictions.xml to the App_Resources/Android/values folder but I get the following build error:
Execution failed for task ':mergeF0F1DebugResources'.
Error: Unsupported type 'restriction'
This is the content of app_restrictions.xml:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="downloadOnCellular"
android:restrictionType="bool"
android:defaultValue="true" />
</restrictions>
Does NativeScript support adding restrictions like this? If so, how do I add the restriction resource file. If not, is there some other way to implement managed configurations?
EDIT: Solved by pkanev in the comments. The restrictions file must be placed in App_Resources/Android/xml.
Per the official Android documentation - https://developer.android.com/work/managed-configurations.html
the restrictions configuration needs to be placed in res/xml dir, which corresponds to app/App_Resources/Android/xml in a NativeScript Android app.
This question already has answers here:
Error: The processing instruction target matching "[xX][mM][lL]" is not allowed
(10 answers)
Closed last month.
I am new to this forum and in general in android development. I wish to help solve a problem that I have when running the app. The app I'm developing now is based on an activity of google maps. I've done all steps as creating credentials in google api developers and copy the key to xml and manifest. When I run the app I get this error:
Error: (2, 10) Error: The fate of the processing instruction that matches" [xX] [mM] [lL] "is not allowed. App: mergeDebugResources FAILED
What I'm trying for now is just to run the app and show me the google maps
This is google_maps_api.xml:
<resources><string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">AIzaSyDtbq2HdPj5VpKCCvhj1vbuUaA1HIAz8Gg</string>
<?xml version="1.0" encoding="utf-8" ?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/></resources>
I also faced the same problem in one of my android projects.
in my case, it is coming from the AndroidManifest.xml. because I added
<?xml version="1.0" encoding="utf-8"?>
in the starting of the file
this line should not be there in the file . and I resolve it by removing the
line.
In your case also you have the line in the AndroidManifest.xml file. So remove it. I think it will solve your problem.
I decompiled an app using an online tool (www.decompileandroid.com) then, after I downloaded the zipped source code (assets + java code), I extracted it in a folder and finally I imported the folder in android studio (File>New>Import Project).
Then, without editing any file, I tried to run the project but I got this error:
Error: Found item ###/ITEM-NAME more than one time
Error:Execution failed for task ':app:mergeDebugResources'. > C:\Users\Fabrizio\AndroidStudioProjects\com.hwlogos.ytstars\app\src\main\res\values\public.xml: Error: Found item ###/ITEM.NAME more than one time
I searched the web for hours but I can't find any useful answer...
Please help!
PS: I tried also with other applications but I always get the same error...
UPDATE:
Now I tried to decompile a simple app i created with android studio and when I reimported it in android studio I got the same error.
it seems there are two resources with the same name, one declared as string and the other as id.
Here's a part of my public.xml, which i never wrote when I made my application!!!
<public type="string" name="action_settings" id="0x7f070006" />
<public type="id" name="action_settings" id="0x7f09000a" />
Create a new xml ids.xml in values with all the id values which are to be constant.
<resources>
<item type="id" name="index_row_search" />
</resources>
I think its better if you copy the resource ids to public.xml from the R.java, the first time to avoid errors like entry index is larger than available symbols and also to keep the type of resource to be consistent.
visit here for more help How to add id to public.xml?