Search code examples
fluttergradlebuildflutter-dependencies

gradle build error [Fatal Error] checker-qual-2.5.2.pom:2:1: Content is not allowed in prolog


[Fatal Error] checker-qual-2.5.2.pom:2:1: Content is not allowed in prolog.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.checkerframework:checker-qual:2.5.2.
     Required by:
         project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.analytics-library:crash:26.5.0 > com.google.guava:guava:27.0.1-jre
      > Could not resolve org.checkerframework:checker-qual:2.5.2.
         > Could not parse POM https://jcenter.bintray.com/org/checkerframework/checker-qual/2.5.2/checker-qual-2.5.2.pom
            > Content is not allowed in prolog.
   > Could not resolve org.glassfish.jaxb:jaxb-runtime:2.2.11.
     Required by:
         project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools:sdklib:26.5.0 > com.android.tools:repository:26.5.0
      > Could not resolve org.glassfish.jaxb:jaxb-runtime:2.2.11.
         > Could not parse POM https://jcenter.bintray.com/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.pom
            > Could not resolve com.sun.xml.bind.mvn:jaxb-runtime-parent:2.2.11.
               > Could not resolve com.sun.xml.bind.mvn:jaxb-runtime-parent:2.2.11.
                  > Could not parse POM https://jcenter.bintray.com/com/sun/xml/bind/mvn/jaxb-runtime-parent/2.2.11/jaxb-runtime-parent-2.2.11.pom
                     > Could not resolve com.sun.xml.bind.mvn:jaxb-parent:2.2.11.
                        > Could not resolve com.sun.xml.bind.mvn:jaxb-parent:2.2.11.
                           > Could not parse POM https://jcenter.bintray.com/com/sun/xml/bind/mvn/jaxb-parent/2.2.11/jaxb-parent-2.2.11.pom
                              > Resetting to invalid mark

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 44s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Solution

  • I had this same problem once. I found the problem was because of my firewall. I disabled the firewall for a while to run my app and it worked fine. After that, I added Android Studio to my firewall whitelist.

    If the firewall is causing you the problem, disable the firewall and try to run it again. If it works, add Android Studio to the firewall whitelist.

    Hope it helps :)

    EDIT:

    Since the above solution is not working, delete all the contents of the following directories after closing Android Studio:

    C:\Users\username\.gradle\caches
    C:\Users\username\.android\build-cache
    C:\Users\username\.android\cache