简体   繁体   English

无法获取“https://google.bintray.com/.../maven-metadata.xml”。 从服务器收到状态代码 403:禁止访问

[英]Could not GET 'https://google.bintray.com/.../maven-metadata.xml'. Received status code 403 from server: Forbidden

when I try to build my flutter application I faced is problem:当我尝试构建我的 flutter 应用程序时,我遇到了问题:

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.无法确定任务“:app:compileDebugJavaWithJavac”的依赖关系。

Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.无法解析配置“:app:debugCompileClasspath”的所有任务依赖性。 Could not resolve com.google.android.gms:play-services-location:16.+.无法解析 com.google.android.gms:play-services-location:16.+。 Required by: project:app > project:location > Failed to list versions for com.google.android.gms:play-services-location.要求:project:app > project:location > 无法列出 com.google.android.gms:play-services-location 的版本。 > Unable to load Maven meta-data from 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加载 Maven 元数据。 > Could not get resource '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”。 > Could not GET '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”。 Received status code 403 from server: Forbidden从服务器收到状态代码 403:禁止访问

I have tried everything but nothing works:我已经尝试了一切但没有任何效果:

1- I have a stable inte.net connection 1- 我有稳定的互联网连接

2- I have tried updating or downgrading com.android.tools.build.gradle version 2- 我已经尝试更新或降级 com.android.tools.build.gradle 版本

3- I have tried cleaning caches 3-我试过清理缓存

4- I have tried removing all firebase libraries 4- 我尝试删除所有 firebase 库

5- I replaced JCentre() with mavenCentral() 5-我用 mavenCentral() 替换了 JCentre()

There is my android -> build.gradle file:有我的 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
}

and here is my android build.gradle file:这是我的 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'
}

finally my flutter doctor result:最后我的 flutter 医生结果:

[√] Flutter (Channel unknown, 2.0.0, on Microsoft Windows [version 10.0.19042.1052], locale fr-TN) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.1) [√] Chrome - develop for the web [√] Android Studio (version 4.0) [√] VS Code (version 1.57.1) [√] Connected device (3 available) [√] Flutter(频道未知,2.0.0,在 Microsoft Windows [版本 10.0.19042.1052],区域设置 fr-TN)[√] Android 工具链 - 为 Android 设备开发(Android 883830587145)[0.Chrome305871453]为 web 开发 [√] Android Studio(4.0 版)[√] VS Code(1.57.1 版)[√] 已连接设备(可用 3 个)

• No issues found! • 没有发现问题!

After trying everything that I found on Google.在尝试了我在谷歌上找到的所有内容之后。 It took me almost 3 days.我花了将近3天的时间。 I finally found a workaround for me:我终于为我找到了解决方法:

Upgrade your gradle to the latest version.将您的 gradle 升级到最新版本。 In android/build.gradle file:android/build.gradle文件中:

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

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


And in android/gradle/wrapper/gradle-wrapper.properties file:android/gradle/wrapper/gradle-wrapper.properties文件中:

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

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

My project is working again.我的项目又开始工作了。

One of the reasons is that you entered the Gradle Plugin Version incorrectly or such classpath 'com.android.tools.build.gradle:4.1+' (with + ), so the problem occurs.原因之一是你输入的Gradle Plugin Version有误,或者类classpath 'com.android.tools.build.gradle:4.1+' (with + ),所以出现问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法获取“https://fyber.bintray.com/maven/com/fyber/fairbid-sdk/3.0.1/fairbid-sdk-3.0.1.aar”。 从服务器收到状态代码 403:禁止 - Could not GET 'https://fyber.bintray.com/maven/com/fyber/fairbid-sdk/3.0.1/fairbid-sdk-3.0.1.aar'. Received status code 403 from server: Forbidden Bintray:Maven-Publish with Gradle Bintray 插件不上传 maven-metadata.xml 校验和文件 - Bintray : Maven-Publish with Gradle Bintray Plugin doesn't upload maven-metadata.xml checksum file 编译失败 - 无法从 https://maven.repository.redhat.com/ga/javax/servlet/javax.servlet-api/maven-metadata.xml 加载 Maven 元数据 - compile failing - Unable to load Maven meta-data from https://maven.repository.redhat.com/ga/javax/servlet/javax.servlet-api/maven-metadata.xml 发布期间在本地找不到 maven-metadata.xml - Could not find maven-metadata.xml in local during release 从服务器收到状态代码 403:禁止禁用 Gradle“离线模式”并同步 ANDROID STUDIO 中的项目 - Received status code 403 from server: Forbidden Disable Gradle 'offline mode' and sync project in ANDROID STUDIO Maven 无法从 uk.maven.org 传输元数据 org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml - Maven Could not transfer metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml from uk.maven.org Gradle 构建错误:无法从 https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml 加载 Maven 元数据 - Gradle Build Error: Unable to load Maven meta-data from https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml maven-metadata.xml构建错误 - maven-metadata.xml build error maven-glassfish-plugin无法获取maven-metadata.xml - maven-glassfish-plugin can't get maven-metadata.xml Maven插件是否可以从远程存储库请求maven-metadata.xml? - Is there a way for a maven plugin to request maven-metadata.xml from a remote repository?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM