【问题标题】:Flutter Could not determine the dependencies of task ':app:processDebugResources'Flutter 无法确定任务 ':app:processDebugResources' 的依赖关系
【发布时间】:2022-01-17 16:49:27
【问题描述】:

无法确定任务 ':app:processDebugResources' 的依赖关系。

无法解析配置“:app:debugRuntimeClasspath”的所有任务依赖项。 无法解析 com.facebook.android:facebook-login:[5,6)。

要求: 项目:应用程序 > 无法列出 com.facebook.android:facebook-login 的版本。 > 无法从 https://google.bintray.com/exoplayer/com/facebook/android/facebook-login/maven-metadata.xml 加载 Maven 元数据。 > 无法获取资源“https://google.bintray.com/exoplayer/com/facebook/android/facebook-login/maven-metadata.xml”。 > 无法获取“https://google.bintray.com/exoplayer/com/facebook/android/facebook-login/maven-metadata.xml”。从服务器收到状态码 502:Bad Gateway

  • 尝试: 使用 --stack trace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

应用级/buildgradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
    localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the 
local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID 
  (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.deligence.hookup4u2"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    // Use code below for production build
    // For debug mode you need to comment above lines of code
    // Issue with 'libflutter.so'
    ndk {
        abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86'
    }
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}
}

flutter {
source '../..'
}

 dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.facebook.android:facebook-login:[5,6)'
implementation 'com.google.firebase:firebase-messaging:20.1.6'
}

项目级别/buildGradle

  buildscript {
   ext.kotlin_version = '1.3.50'
   repositories {
    google()
    jcenter()
  }

dependencies {
     classpath 'com.android.tools.build:gradle:3.5.0'
    classpath 'com.google.gms:google-services:4.3.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    
}
}

allprojects {
repositories {
    google()
    jcenter()
}
}

 rootProject.buildDir = '../build'
 subprojects {
 project.buildDir = "${rootProject.buildDir}/${project.name}"
 }
 subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
 }

【问题讨论】:

    标签: flutter flutter-layout flutter-dependencies flutter-web flutter-animation


    【解决方案1】:

    google.bintray.com 下线但 com.facebook.android:facebook-login 版本未严格指定的问题。

    [5,6)表示它的版本范围Gradle Declaring Versions and Ranges

    1. 搜索 com.facebook.android:facebook-login Maven search 的版本。我们有 5.15.x

    2. 使用最大可能的版本 5.15.3 约束您的传递依赖

    编辑您的项目app/build.gradle

    dependencies {
      ...
      constraints {
        implementation('com.facebook.android:facebook-login') {
            version {
                strictly '5.15.3'
            }
        }
      }
    }
    

    【讨论】:

    • 编辑上述更改后,我得到另一个错误无法确定任务':app:processDebugResources'的依赖关系。 > 无法解析配置 ':app:debugRuntimeClasspath' 的所有任务依赖关系。 > 无法解析 com.google.android.gms:play-services-location:16.+。要求:project :app > project :location > 无法列出 com.google.android.gms:play-services-location 的版本。
    • 添加约束的原因与stackoverflow.com/questions/70327441/…中相同
    猜你喜欢
    • 2021-04-14
    • 2021-02-16
    • 2021-07-25
    • 2021-11-02
    • 2020-06-30
    • 2021-07-25
    • 2020-07-11
    • 2020-09-17
    • 2020-10-04
    相关资源
    最近更新 更多