【问题标题】:Could not GET 'https://google.bintray.com/.../maven-metadata.xml'. Received status code 403 from server: Forbidden无法获取“https://google.bintray.com/.../maven-metadata.xml”。从服务器收到状态码 403:Forbidden
【发布时间】:2021-09-16 04:46:05
【问题描述】:

当我尝试构建我的颤振应用程序时,我遇到了问题:

无法确定任务的依赖关系 ':app:compileDebugJavaWithJavac'.

无法解析配置 ':app:debugCompileClasspath' 的所有任务依赖项。 无法解析 com.google.android.gms:play-services-location:16.+。 要求: 项目:应用程序>项目:位置 > 无法列出 com.google.android.gms:play-services-location 的版本。 > 无法从 https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml 加载 Maven 元数据。 > 无法获取资源“https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml”。 > 无法获取“https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml”。 从服务器收到状态码 403:禁止

我已经尝试了所有方法,但没有任何效果:

1- 我有稳定的互联网连接

2- 我已尝试更新或降级 com.android.tools.build:gradle 版本

3- 我试过清理缓存

4- 我已尝试删除所有 firebase 库

5- 我用 mavenCentral() 替换了 JCentre()

有我的 android -> build.gradle 文件:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.2'
    }
}

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
}

这是我的 android build.gradle 文件:

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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "io.bujupah.hestia"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    testImplementation'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:2.17.0'
    implementation 'com.android.support:multidex:1.0.3'
}

最后是我的颤振医生结果:

[√] Flutter (Channel unknown, 2.0.0, on Microsoft Windows [version 10.0.19042.1052],区域设置 fr-TN)[√] Android 工具链 - 为 Android 设备开发(Android SDK 版本 30.0.1)[√] Chrome - 为 网络 [√] Android Studio (4.0 版) [√] VS Code (1.57.1​​ 版) [√] 已连接设备(3 个可用)

• 未发现任何问题!

【问题讨论】:

    标签: java android flutter maven


    【解决方案1】:

    在尝试了我在 Google 上找到的所有内容之后。我花了将近3天的时间。我终于找到了一个解决方法:

    将您的 gradle 升级到最新版本。在android/build.gradle 文件中:

    我编辑了classpath 'com.android.tools.build:gradle:3.6.3'

    classpath 'com.android.tools.build:gradle:4.2.0'


    android/gradle/wrapper/gradle-wrapper.properties 文件中:

    我编辑了distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

    distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

    我的项目又开始运作了。

    【讨论】:

    • 你的工作真棒!我的已经有了这些更新的配置行,但出于同样的原因,它仍然无法构建。 是什么让你发现了这个解决方案?我也许可以按照这些步骤来找出如何修复我的构建
    【解决方案2】:

    其中一个原因是你输入了错误的Gradle Plugin Version或者classpath 'com.android.tools.build:gradle:4.1+'(带+),所以出现了问题。

    【讨论】:

      猜你喜欢
      • 2019-12-31
      • 2021-07-25
      • 2019-03-24
      • 1970-01-01
      • 2022-01-07
      • 2020-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多