dart 无法解析com.android.tools.build:gradle:7.4.1

ix0qys7i  于 2023-04-09  发布在  Android
关注(0)|答案(1)|浏览(203)

我是新的Flutter,我有一个正在运行的项目,并更新到最新的Flutter版本和升级的一个依赖.现在,当我尝试运行该项目我ge此错误消息:

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:7.4.1.
     Required by:
         project :
      > Cannot choose between the following variants of com.android.tools.build:gradle:7.4.1:
          - javadocElements
          - sourcesElements
        All of them match the consumer attributes:
          - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.1:
              - Unmatched attributes:
                  - Found org.gradle.category 'documentation' but wasn't required.
                  - Found org.gradle.docstype 'javadoc' but wasn't required.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'jar' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
              - Compatible attributes:
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
          - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.1:
              - Unmatched attributes:
                  - Found org.gradle.category 'documentation' but wasn't required.
                  - Found org.gradle.docstype 'sources' but wasn't required.
                  - Required org.gradle.jvm.version '8' but no value provided.
                  - Required org.gradle.libraryelements 'jar' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
              - Compatible attributes:
                  - Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
                  - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.

医生怎么说

[✓] Flutter (Channel stable, 3.7.9, on macOS 12.6.2 21G320 darwin-x64, locale en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.60.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

从那时起,我不能运行我的项目,任何人都可以帮助。
先谢谢你。

gkl3eglg

gkl3eglg1#

在build.gradle项目级别集classPath中

buildscript {
   repositories {
    google()
    mavenCentral()
}
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.4"

    }
}

在www.example.com中gradle-wrapper.properties设置此

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

相关问题