I recently migrated to Android Studio 4.0 and made the decision to update all dependencies, including Gradle.
When I tried to compile the app, this error [the image below] is shown.
This type of error usually happens when libraries are updated, so I decided to go back to a previous commit where I didn't make any modifications but I was surprised that the error was still there.
I proceeded to check some similar errors on the network and made several changes with my gradle and dependencies .. even i went back to the previous version of Android 3.5 but the error persists.
I don't understand what the error might be. This image shows the versions of Gradle that I am using and the error that is displayed, I think it has to do with POM parser.
[Fatal Error ]Getting root element must be well-formed. error in android build
Does anyone knows what might be wrong?
There is also an error with some libraries i am using (for example: paycards).
https://github.com/faceterteam/PayCards_Android
the error shown is:
The markup in the document following the root element must be well-formed (but its in spanish... why???)
Today is 4 jun 2020 and i've made some research. there is actually some people with this error so i found a temporal solution an the Github 'Open Issues' segment of the PayCards library.
This issue was opened 3 days ago so i think its a new issue with the library.
https://github.com/faceterteam/PayCards_Android/issues/49
I'm trying to get rid of the soon-to-be-removed option android.enableAapt2=false from our project. It's been painful, but I hope I'm getting there.
Now I'm stuck with a BuildException: Failed to process resources, see aapt output above for details.
The issue seems to be this:
error: style attribute '#android:attr/textColor' not found.
Message{kind=ERROR, text=error: style attribute '#android:attr/textColor' not found.,
sources=[/Users/<username>/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/4215c9c9bb2efc5bb086ff343ac44128/res/values/values.xml],
original message=, tool name=Optional.of(AAPT)}
I've found the following question and answer, but I believe it's a bit different when it's not in our own project it's happening: Cannot complete Gradle Build, failed linking references
What's the reason for this happening and how can I solve it?
The specs:
Android Studio 3.1.2
JRE: 1.8.0_152-release-1024-b01 x86_64
buildToolsVersion: 27.0.3
Gradle: 4.6
Gradle plugin: 3.1.2
Edit:
Just in case I removed every single line of styles and attributes from our project and did a clean build and invalidation of cache and restart and everything, but the build was still pointing its finger at the values.xml of com.android.support:appcompat-v7:27.1.1.
I had the same issue and found out that the main problem was that aapt2 did not report the problem location correctly.
Do a global search of all your style xml files for name="#android.
This is part of <item name="#android:...
You need to remove the # character.
I have found this line in one of the files: <item name="#android:textColor">#FF000000</item>
aapt2 reported correctly issues with other locations where it found the # character, but for some reason, it didn't report it correctly in this case.
You may need to search shared files or even library aar files if you have any.
I'm an Android Studio noob and I'm confused about how it reports errors. I have a fairly large Android project - about 25 java source files - mostly Activities - and a similar number of XML files.
I do a Build > Clean Project and a Build > Rebuild Project, and the Gradle Console reports BUILD SUCCESSFUL. In the Messages tab it says:
BUILD SUCCESSFUL
Total Time 4.368 seconds
0 errors
0 warnings
But if I actually open up an XML file, e.g., the Android manifest.xml file, I see errors marked in red, such as
Cannot resolve symbol 'PlyListActivity'
and
Cannot resolve symbol 'ActivityMsgClass'
... those seem like errors to me. Yet the Android manifest.xml file is not marked or highlighted in any way in the UI - if I hadn't opened it in the editor I wouldn't have seen those errors. So short of opening up each of the 25 XML files in my project, how can I find out about such errors when I do a build?
Edit: Just to be clear - my question is not about what causes the errors listed in the manifest. My question is why does the build show 0 errors and 0 warnings, and is there any way in Android Studio to be aware of these errors/warnings short of having to open up each and every file (25 in my case) in the editor to look for them?
This is a very annoying bug, and it's been around forever. Unfortunanetly, there is no way you can fix it, this doesn't only happen to the Manifest but to the resources XML files too. However, your app will crash if there is a real error, not a warning.
However, there could be a way if you mess around Android Studio, I couldn't find this, but maybe you could:
Go to Android Studio. Go to File>Settings, alternatively press CTRL+ALT+S
Go to Editor>Inspections,now here, you can change all the errors in Android Studio to a warning, or nothing and vise-versa. This could solve your problem if you find your error in this window and disable it (Make sure it is Manifest Only). Otherwise, I hate to say the answer even for myself, there is no solution.
UPDATE: If you go to Analyze>Inspect Code you can see all your errors and warnings in your project.
This is not an error. This show both the class are not defined in your project as activity, but you have still defined in manifest as activity.
If you run the 'lint' gradle task, it should generate an webpage that details all the warning/error/issues it detects during build time.
Ran lint on variant debug: 11 issues found
Ran lint on variant release: 11 issues found
Wrote HTML report to file:///C:/Android/JsoupExample/app/build/outputs/lint-results-debug.html
Wrote XML report to file:///C:/Android/JsoupExample/app/build/outputs/lint-results-debug.xml
Following a tutorial, I have a styles.xml file with the following code:
<style name="ActionBar.Solid.Sunshine"
parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
Android Studio gives me the error that Widget.Appcompat.Light and Widget.Appcompat cannot be resolved, although it still works at build time. I am a beginner and am quite at lost as to what caused this error. Any pointers?
On another related note, where do I find the list of default resources I can use, such as the Widget given to me above?
Thanks!
Building the project throws the following error from AAPT. I've rebuilt the project, but it is still failing. I can't find any references anywhere to what this error code actually means. I'm using Java 6, and Android tools r19 in IntelliJ with ActionBarSherlock v4.1.0.
I/O error: Command
"C:\android-sdk-windows\platform-tools\aapt.exe package -m --auto-add-overlay --extra-packages com.actionbarsherlock -J C:\Users\Ollie\.IntelliJIdea11\system\compiler\project6.b9f5599b\.generated\aapt\Project.9617c193\production -M C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/AndroidManifest.xml -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/res -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/actionbarsherlock/res -I C:\android-sdk-windows\platforms\android-14\android.jar"
execution failed with exit code -1073741819
This build failure started happening after I added a dependency from my project to the ActionBarSherlock library project. If I remove that dependency, the project builds fine. If I add it back, it fails again.
I had this problem under windows, I fixed it by removing a #+id in a style item definition in the styles.xml. I spoke to someone else who didn't know exactly why but had found using +id in style files to often cause problems.
Update Oct. 27, 2014 -
the problem is fixed with Android SDK Build-tools rel. 21.0.2, sigh of relief... Guess I'll leave the rest of this post as it was, in case someone with v. 21.0.1 runs into this problem, or if the bug returns in future releases of the tools. Maybe it'll save someone bunging head against a tool-bug wall, reviewing all other posts and their code for a whole day.
Original post from Oct. 18, 2014
A new twist on this old issue... Today, Oct. 18, 2014, after upgrading to just released Android SDK v. 21 on my Windows 7 computer, using aapt.exe from android-sdk\build-tools\21.01\ directory crashes each time with the same exit code -1073741819. Tried all the answers suggested in this thread before my post to no avail. Then just copied the old version of aapt.exe from 20.0.0 (also tried from 19.1.0 tools directory), and in each case it worked fine. No issues (just had to clean-rebuild the project with each version of aapt.exe tested).
Is aapt.exe for Windows, in Android SDK built tools version 21.0.1 broken? Does anyone else see this problem?
Greg
For anyone else experiencing this issue in Android Studio, this is how I solved it:
I copied the aapt.exe command that shows in the output window. For example:
C:\android-sdk-windows\platform-tools\aapt.exe package -m --auto-add-overlay --extra-packages com.actionbarsherlock -J C:\Users\Ollie\.IntelliJIdea11\system\compiler\project6.b9f5599b\.generated\aapt\Project.9617c193\production -M C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/AndroidManifest.xml -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/res -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/actionbarsherlock/res -I C:\android-sdk-windows\platforms\android-14\android.jar
At the end I appended the -v to the end of that command and ran it in a command prompt window. That switch turns on verbose logging. Eventually the command will fail, but the very last file that it attempts to package is the culprit. I suggest focusing your efforts on that file.
General solution to this problem lies in XML code. There is something in the XML code which is being pointed , but not present. In my case, a unreachable string causes this error.
<item android:title="#string/action_settings">
Due to some code merging, this string code deleted, and compiler is unable to find it.I changed it & whoop.. error is gone.
In most of the languages, 1073741819 error is usually thrown whenever there is problem accessing resources
Make sure all your #+id/... (in main.xml and others) are also registered in strings.xml.
The problem I had was that
<item android:id="#+id/menu_help" android:title="#string/menu_help"/> in my main.xml file was not defined in my strings.xml file.
Take a look at here.
It is related to Android Develop's second class, of adding action buttons.
It is simply that the drawable "ic_action_search" is not present. Well, it was the case for me.
The class links to Action bar icon pack where you can find your missing PNGs and add to your project.
Hope it helps,
SJ
I think aapt ErrorCode -1073741819 means Android resources are conflict or illegal.
Whenever I meet this error on android projects of others' or my own, I usually find required attributes in layout/xxx.xml are missing, or id, name attributes are conflicts in different layout/xxx.xml
I had the same problem in Eclipse.
Eclipse now and then shows up those kind of errors, a simple refresh in my project fixed that error for me.
Had the same problem.There was a reference inside an layout xml file pointing to an object that wasn't in the source code anymore.You probably should check your main layout files first.
I just faced this issue again. Previous time I was not able to found the reason of the error so I had to clear everything and carefully add files and resources one by one. But now I found another reason for this error. I used method provided here by Software.Developer but in my case the culprit was not the last line but penultimate line. It was a menu xml file and the problem was at the first line in this file. It was empty and the xml declaration
xml version="1.0" encoding="utf-8"
was placed at the second line. IntelliJ IDEA static analyzer doesn't highlight this error until you open the file and compiler just crash at the compilation. So make sure all of your xml files (layouts, styles, menus) have proper xml declarations placed at the first line of the file.
I fixed this with cleaning the project before compiling it again.
The error code I got is -1073741502 which is slightly different, but I think it's just the id that generated from previous build of aapt.
In my case problem was in my menu.xml. Look at this one:
<menu 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"
>
<item android:id="#+id/action_help"
android:title="#string/help"
android:orderInCategory="100"
app:showAsAction="never"
/>
</menu>
Renaming namespace for app:showAsAction from app to android solved this problem.
Here goes the right way
<item android:id="#+id/action_help"
android:title="#string/help"
android:orderInCategory="100"
android:showAsAction="never"
/>
One more resource problem - add formatting="false" to your strings which contain %s formatting characters.
See more at Android XML Percent Symbol
In my case (Android Studio on Windows 8.1) aapt would sometimes get stuck and every launch from command line would crash (but not when double-clicked in Explorer). When I terminated all cmd.exe and conhost.exe processes in Task Manager clean & build went just fine.
this error will be generated when your xml has some problems
but eclipse will not show real problem when Project>Build Automatically is checked
First thing you must do is to uncheck that option, Build All, and see problems window.
for me, I deleted a string from resources, but not its usage, so it takes 2 working days from me to find out what the problem is
Generally this error is observed due to some missing parameter or some syntax error in xml file.
You can refer the Messages view for gradle build.
There it states, which file is having error.
In my case, in one of the layout xml, there was some extra character.
Try removing the build tool with versions earlier than 19 from the android build tool folder, then install build tool 19 from the sdk manager, copy the lib folder and aapt.exe to platform-build folder.