配置项目 ':path_provider' 时出现问题

时间:2021-06-15 17:18:58

标签: java android flutter gradle

我遇到这个错误已经有一段时间了,但我没有运气解决它。我使用的是 Flutter 版本 2.2.1,每当我尝试运行我的项目时,我都会收到以下错误:

[Fatal Error] auto-parent-3.pom:2:1: Content is not allowed in prolog.  
[Fatal Error] google-1.pom:2:1: Content is not allowed in prolog.       
[Fatal Error] google-1.pom:2:1: Content is not allowed in prolog.       
                                                                        
FAILURE: Build failed with an exception.                                

* What went wrong:
A problem occurred configuring project ':path_provider'.
> Could not resolve all artifacts for configuration ':path_provider:classpath'.
   > Could not resolve com.google.auto.value:auto-value:1.5.2.
     Required by:
         project :path_provider > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:bundletool:0.6.0
      > Could not resolve com.google.auto.value:auto-value:1.5.2.
         > Could not parse POM https://repo.maven.apache.org/maven2/com/google/auto/value/auto-value/1.5.2/auto-value-1.5.2.pom
            > Could not resolve com.google.auto:auto-parent:3.          
               > Could not resolve com.google.auto:auto-parent:3.       
                  > Could not parse POM https://repo.maven.apache.org/maven2/com/google/auto/auto-parent/3/auto-parent-3.pom
                     > Content is not allowed in prolog.                
   > Could not resolve com.google.protobuf:protobuf-java:3.4.0.         
     Required by:                                                       
         project :path_provider > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:bundletool:0.6.0
         project :path_provider > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools:sdk-common:26.3.0
         project :path_provider > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools.analytics-library:protos:26.3.0         project :path_provider > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools.analytics-library:tracker:26.3.0
         project :path_provider > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:bundletool:0.6.0 > com.android.tools.build:aapt2-proto:0.3.1
      > Could not resolve com.google.protobuf:protobuf-java:3.4.0.
         > Could not parse POM https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.4.0/protobuf-java-3.4.0.pom
            > Could not resolve com.google.protobuf:protobuf-parent:3.4.0.
               > Could not resolve com.google.protobuf:protobuf-parent:3.4.0.
                  > Could not parse POM https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.4.0/protobuf-parent-3.4.0.pom
                     > Could not resolve com.google:google:1.
                        > Could not resolve com.google:google:1.
                           > Could not parse POM https://repo.maven.apache.org/maven2/com/google/google/1/google-1.pom
                              > Content is not allowed in prolog.
   > Could not resolve com.google.protobuf:protobuf-java-util:3.4.0.
     Required by:
         project :path_provider > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:bundletool:0.6.0
      > Could not resolve com.google.protobuf:protobuf-java-util:3.4.0. 
         > Could not parse POM https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java-util/3.4.0/protobuf-java-util-3.4.0.pom
            > Could not resolve com.google.protobuf:protobuf-parent:3.4.0.
                  > Could not parse POM https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.4.0/protobuf-parent-3.4.0.pom
                     > Could not resolve com.google:google:1.
                        > Could not resolve com.google:google:1.
                           > Could not parse POM https://repo.maven.apache.org/maven2/com/google/google/1/google-1.pom
                              > Content is not allowed in prolog.
> Could not get unknown property 'android' for project ':path_provider' of type org.gradle.api.Project.

* 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 3m 21s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                       218.9s
Exception: Gradle task assembleDebug failed with exit code 1

我无法弄清楚为什么会发生此错误。 这是我运行 flutter doctor -v 时的输出:

[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19042.1052], locale en-US)
    • Flutter version 2.2.1 at C:\src\flutter
    • Framework revision 02c026b03c (3 weeks ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Abhinav\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
    • All Android licenses accepted.

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

[!] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.4)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.9.31205.134
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these
      components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[√] Android Studio (version 4.1.0)
    • 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 11.0.8+10-b944.6842174)

[√] VS Code (version 1.57.0)
    • VS Code at C:\Users\Abhinav\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.23.0

[√] Connected device (4 available)
    • Redmi Note 8 Pro (mobile) • 8livzdlvnnsoy5qw • android-arm64  • Android 10 (API 29)
    • Windows (desktop)         • windows          • windows-x64    • Microsoft Windows [Version 10.0.19042.1052]
    • Chrome (web)              • chrome           • web-javascript • Google Chrome 91.0.4472.101
    • Edge (web)                • edge             • web-javascript • Microsoft Edge 90.0.818.62

! Doctor found issues in 1 category.

这是我的 pubspec.yaml 文件:

name: new_registreation1
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.11.0 <3.0.0"

dependencies:
  pinput: ^1.2.0
  flutter_swiper: ^1.1.6
  syncfusion_flutter_sliders: ^19.1.67-beta
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  google_fonts: ^2.0.0-nullsafety.0
  flutter_svg: ^0.22.0
  flutter_signin_button: ^2.0.0
  pin_code_fields: ^7.2.0
  percent_indicator: ^3.0.1
  flutter_range_slider: ^1.5.0
  palette_generator: ^0.3.0

dev_dependencies:
  flutter_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/image1.svg
    - assets/image2.svg
    - assets/image3.svg
    - assets/image4.svg
    - assets/image5.svg
    - assets/image6.svg
    - assets/image7.svg
    - assets/image8.svg
    - assets/image9.svg
    - assets/image10.svg
    - assets/image11.svg
    - assets/image12.svg
    - assets/image13.svg
    - assets/image14.svg
    - assets/back.png
    - assets/ChatsCircle.png
    - assets/next.png
    - assets/heart.png
    - assets/profileIcon.png
    - assets/refresh.png
    - assets/Spotify Icon.png
    - assets/google_icon.svg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

如果需要,我会附加更多输出。

0 个答案:

没有答案