3

We have a project that uses different product flavors and product types. When I select a particular flavor, this error is generated:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processSomeFlavorDebugManifest'.
> com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

Here is what I have tried:

  • ran the task with -info, -debug, -scan, not very helpful.
  • reviewed the two manifest files to ensure there are no weird characters or spaces in the prolog
  • cleaned project
  • rebuilt project
  • invalidated cache and restart
  • deleted AndroidSDK and Android Studio (also AndroidStudio3.5 directories in ~/Library/...)

Weird thing is, this exact branch builds perfectly fine for others. Did anyone encounter this before?

Takeshi Kaga
  • 47
  • 2
  • 15

3 Answers3

0

Try This Solution:

Gradle assemble -info gave me the hint that the Manifests have different SDK Versions and cannot be merged.

I needed to edit my Manifests and build.gradle file and everything worked again.

To be clear you need to edit the uses-SDK in the AndroidManifest.xml

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />

and the android section, particularly minSdkVersion and targetSdkVersion in the build.Gradle file

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 16
    }
}
S_i_l_e_n_t C_o_d_e_r
  • 2,179
  • 2
  • 7
  • 21
0

This error is thrown from "manifest merger" inside of android gradle plugin.

Try to add this line to the manifest node in your main manifest file.

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

Note: You need to use the same android support library version. You need to use support library 28.0.0 version.

I hope it'll help you..!

Viral Patel
  • 1,196
  • 1
  • 9
  • 24
0

check that your manifest have this

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="yourpacagename">

for more info check this issue on github

also all your xml files should have this line at the beginning

<?xml version="1.0" encoding="UTF-8"?>
Mohammed Alaa
  • 2,775
  • 2
  • 15
  • 20