Android 构建错误:无法获取 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.0.2-6197926/aapt2-4.0.2-6197926-osx罐子'

问题描述

一周以来我面临着多个问题。 这是当前的错误:无法获取'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.0.2-6197926/aapt2-4.0.2-6197926- osx.jar'。从服务器收到状态代码 405:方法不允许 启用 Gradle 的“离线模式”并同步项目

我使用的是 Android Studio 4.0.2 版,并且启用/禁用了离线模式。

这些是我的成绩文件:

build.gradle(module: app)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.fithubapptrialnew"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
        }
    }
}

dependencies {

}

build.gradle(项目)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

我尝试过使缓存无效/重启、清理项目和重建

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...