Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android manifest merger error messages are unnecessarily dropped #6904

Closed
jin opened this issue Dec 12, 2018 · 0 comments
Closed

Android manifest merger error messages are unnecessarily dropped #6904

jin opened this issue Dec 12, 2018 · 0 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Android Issues for Android team

Comments

@jin
Copy link
Member

jin commented Dec 12, 2018

Repro: compile an Android project with the following invalid manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.bazel"
    android:versionCode="1"
    android:versionName="1.0" />

  <uses-sdk
      android:minSdkVersion="21"
      android:targetSdkVersion="26" />

</manifest>

Note the incorrect /> in the opening <manifest> element.

Bazel crashes with:

INFO: Found 1 target...
ERROR: /usr/local/google/home/jingwen/code/examples/android/tutorial-test/src/main/BUILD:1:1: Merging manifest for //src/main:greeter_app failed (Exit 1) ResourceProcessorBusyBox failed: error executing command bazel-out/host/bin/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox --tool MERGE_MANIFEST -- --manifest src/main/AndroidManifest.xml ... (remaining 8 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
Target //src/main:greeter_app failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 9.480s, Critical Path: 3.73s
INFO: 9 processes: 8 linux-sandbox, 1 worker.
FAILED: Build did NOT complete successfully

It is expected to crash with:

ERROR: /usr/local/google/home/jingwen/code/examples/android/tutorial-test/src/main/BUILD:1:1: Merging manifest for //src/main:greeter_app failed (Exit 1) ResourceProcessorBusyBox failed: error executing command bazel-out/host/bin/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox --tool MERGE_MANIFEST -- --manifest src/main/AndroidManifest.xml ... (remaining 8 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
Dec 12, 2018 1:23:25 PM com.google.devtools.build.android.ManifestMergerAction main
SEVERE: Encountered error while attempting to merge manifests
com.google.devtools.build.android.AndroidManifestProcessor$ManifestProcessingException: com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 4; The markup in the document following the root element must be well-formed.
	at com.google.devtools.build.android.AndroidManifestProcessor.mergeManifest(AndroidManifestProcessor.java:189)
	at com.google.devtools.build.android.ManifestMergerAction.main(ManifestMergerAction.java:215)
	at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$11.call(ResourceProcessorBusyBox.java:126)
	at com.google.devtools.build.android.ResourceProcessorBusyBox.processRequest(ResourceProcessorBusyBox.java:240)
	at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:203)
Caused by: com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 4; The markup in the document following the root element must be well-formed.
	at com.android.manifmerger.ManifestMerger2.load(ManifestMerger2.java:474)
	at com.android.manifmerger.ManifestMerger2.merge(ManifestMerger2.java:130)
	at com.android.manifmerger.ManifestMerger2.access$1100(ManifestMerger2.java:58)
	at com.android.manifmerger.ManifestMerger2$Invoker.merge(ManifestMerger2.java:1163)
	at com.google.devtools.build.android.AndroidManifestProcessor.mergeManifest(AndroidManifestProcessor.java:163)
	... 4 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 4; The markup in the document following the root element must be well-formed.
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$TrailingMiscDriver.next(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
	at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:181)
	at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:139)
	at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:101)
	at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:110)
	at com.android.manifmerger.XmlLoader.load(XmlLoader.java:63)
	at com.android.manifmerger.ManifestMerger2.load(ManifestMerger2.java:466)
	... 8 more

Target //src/main:greeter_app failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 10.157s, Critical Path: 3.57s
INFO: 9 processes: 8 linux-sandbox, 1 worker.
FAILED: Build did NOT complete successfully
@jin jin added P1 I'll work on this now. (Assignee required) team-Android Issues for Android team labels Dec 12, 2018
@jin jin self-assigned this Dec 12, 2018
@jin jin changed the title Android manifest merger are unnecessarily dropped Android manifest merger error messages are unnecessarily dropped Dec 12, 2018
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
…rAction.

    Fixes bazelbuild/bazel#6904
    Related, but does not fully address: bazelbuild/bazel#6671

    RELNOTES: Fixed issue where error messages from Android manifest merging actions were not propagated fully.
    PiperOrigin-RevId: 225234503
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Android Issues for Android team
Projects
None yet
Development

No branches or pull requests

1 participant