首页 > 解决方案 > 没有可用于离线模式的 com.android.tools.build:aapt2:4.0.0-6051327 缓存版本

问题描述

自从我在有或没有互联网的情况下收到此错误以来已经有好几天了

   
   1: Task failed with an exception.
   -----------
   * What went wrong:
   Cannot isolate parameters com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@5a125ae5 of artifact transform AarResourcesCompilerTransform
   > Could not isolate value com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@5a125ae5 of type AarResourcesCompilerTransform.Parameters
      > Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
         > Could not resolve com.android.tools.build:aapt2:4.0.2-6197926.
           Required by:
               project :app
            > No cached version of com.android.tools.build:aapt2:4.0.2-6197926 available for offline mode.
            > No cached version of com.android.tools.build:aapt2:4.0.2-6197926 available for offline mode.

// 顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。

buildscript {
    ext.kotlin_version = '1.4.10'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

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

task clean(type: Delete) {
   delete rootProject.buildDir
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "inxt.jisnesese.fumalocker"
        minSdkVersion 15
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    buildToolsVersion '29.0.2'
    lintOptions {
        checkReleaseBuilds false

    }

}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.material:material:1.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
    implementation 'androidx.navigation:navigation-fragment:2.3.0'
    //implementation 'androidx.navigation:navigation-ui:2.3.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    //implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
    //implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
    //implementation 'androidx.navigation:navigation-fragment:2.3.0'
    implementation 'androidx.navigation:navigation-ui:2.3.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.biometric:biometric:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:percent:28.0.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:support-v13:28.0.0'
    

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    //implementation "androidx.core:core-ktx:+"
    //implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

}
buildscript {
    repositories {
        google() // here
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
    }
}

标签: androidkotlingradle

解决方案


推荐阅读