'Flutter application build failed and throwing Fatal Error ( Content is not allowed in prolog.)

I'm facing an issue after run the Flutter Upgrade once again on existing one. When I try to run my app I confronted the error that has given below.

Error

[Fatal Error] x86_debug-1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.pom:2:1: Content is not allowed in prolog. [Fatal Error] flutter_embedding_debug-1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.pom:9:12: An invalid XML character (Unicode: 0x0) was found in the element content of the document.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not resolve io.flutter:x86_debug:1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f. Required by: project :app > Could not resolve io.flutter:x86_debug:1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f. > Could not parse POM https://storage.googleapis.com/download.flutter.io/io/flutter/x86_debug/1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f/x86_debug-1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.pom > Content is not allowed in prolog. Could not resolve io.flutter:flutter_embedding_debug:1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f. Required by: project :app > project :video_player_android project :app > project :wakelock > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f. > Could not parse POM https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f/flutter_embedding_debug-1.0.0-bd539267b42051b0da3d16ffa8f48949dce8aa8f.pom > An invalid XML character (Unicode: 0x0) was found in the element content of the document.

  • 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 26s Exception: Gradle task assembleDebug failed with exit code 1

I've tried every possible solution but couldn't find the right one.

Most tried solution

  allprojects {
repositories {
    ......
    maven {url "https://storage.googleapis.com/download.flutter.io"}
}

}

Reffernce: enter link description here

Flutter Doctor log

[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.19041.1415], locale en-US)
• Flutter version 2.10.3 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (11 days ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\User\AppData\Local\Android\Sdk X cmdline-tools component is missing Run path/to/sdkmanager --install "cmdline-tools;latest" See https://developer.android.com/studio/command-line for more details. X Android license status unknown. Run flutter doctor --android-licenses to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop for Windows X Visual Studio not installed; this is necessary for Windows development. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 4.1) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.65.2) • VS Code at C:\Users\User\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.22.0

[√] Connected device (5 available) • Redmi Note 8 (mobile) • 13ab130b • android-arm64 • Android 10 (API 29) • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19041.1415] • Chrome (web) • chrome • web-javascript • Google Chrome 84.0.4147.125 • Edge (web) • edge • web-javascript • Microsoft Edge 84.0.522.59

[√] HTTP Host Availability • All required HTTP hosts are available

! Doctor found issues in 2 categories.

Note: Code run perfectly on Web version but issue arise when try to run on Emulator or physical device.

Any suggestion and solution on this issue would be appriciated. Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source