简体   繁体   English

找不到 aapt2-4.0.0-6051327-linux.jar (com.android.tools.build:aapt2:4.0.0-6051327)

[英]Could not find aapt2-4.0.0-6051327-linux.jar (com.android.tools.build:aapt2:4.0.0-6051327)

I installed android studio on a new device and stared a new project from android studio templates.我在新设备上安装了 android 工作室,并从 android 工作室模板开始了一个新项目。 but when I want to run the application on a device, the build process fails with this message:但是当我想在设备上运行应用程序时,构建过程会失败并显示以下消息:

Could not find aapt2-4.0.0-6051327-linux.jar (com.android.tools.build:aapt2:4.0.0-6051327).找不到 aapt2-4.0.0-6051327-linux.jar (com.android.tools.build:aapt2:4.0.0-6051327)。 Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.0.0-6051327/aapt2-4.0.0-6051327-linux.jar在以下位置搜索: https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.0.0-6051327/aapt2-4.0.0-6051327-linux.Z68995FCBF432492D15484D240A

here's my android studio details:这是我的 android 工作室详细信息:

Android Studio 4.0
Build #AI-193.6911.18.40.6514223, built on May 20, 2020
Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.3.0-62-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 1237M
Cores: 8
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: org.jetbrains.kotlin

here's my gradle files:这是我的 gradle 文件:

buildscript {
    ext.kotlin_version = "1.3.72"
    ext.realm_version = '5.10.0'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.realm:realm-gradle-plugin:$realm_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'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.1"

    defaultConfig {
        applicationId "com.example.queuewatcher"
        minSdkVersion 19
        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'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.squareup.okhttp:okhttp:2.5.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}

I've seen the similar questions and non of them helped, two most related posts are Could not find com.android.tools.build:aapt2:4.0.0-6051327 and Could not find com.android.tools.build:aapt2:3.2.0 that as you could see in files that I provided can't fix my problem because the solutions were already implemented. I've seen the similar questions and non of them helped, two most related posts are Could not find com.android.tools.build:aapt2:4.0.0-6051327 and Could not find com.android.tools.build:aapt2:正如您在我提供的文件中看到的那样, 3.2.0无法解决我的问题,因为解决方案已经实施。

**EDIT: when I click on the link a jar file downloads on the browser so it's not an internet connection problem **编辑:当我单击链接时,浏览器上会下载 jar 文件,因此这不是互联网连接问题

The solution for me was downgrading android studio to 3.6.1.我的解决方案是将 android studio 降级到 3.6.1。 in order to make this work I needed to downgrade the gradle too.为了完成这项工作,我也需要降级 gradle。 so I downgraded it to 5.6.4.所以我把它降级到5.6.4。 so my gradle-wrapper.properties looks like this:所以我的 gradle-wrapper.properties 看起来像这样:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

and then I down graded the gradle plugin:然后我降级了 gradle 插件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
//apply plugin: 'com.android.application'
buildscript {
    ext.kotlin_version = "1.3.72"
    ext.realm_version = '6.0.2'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.realm:realm-gradle-plugin:$realm_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
}

**NOTE: **笔记:

please note that it's just a work-around and I couldn't find a decent reason and therefore a decent solution for this!请注意,这只是一种解决方法,我找不到合适的理由,因此找不到合适的解决方案!

暂无
暂无

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

相关问题 没有缓存版本的 com.android.tools.build:aapt2:4.0.0-alpha09-6051327 可用于离线模式。 安卓 4.0 金丝雀 9 - No cached version of com.android.tools.build:aapt2:4.0.0-alpha09-6051327 available for offline mode. android 4.0 canary 9 找不到com.android.tools.build:aapt2 AndroidStudio - Could not find com.android.tools.build:aapt2 AndroidStudio 找不到 com.android.tools.build:aapt2:3.2.0 - Could not find com.android.tools.build:aapt2:3.2.0 Android-找不到com.android.tools.build:aapt2:3.2.1-4818971。 在以下位置搜索: - Android - Could not find com.android.tools.build:aapt2:3.2.1-4818971. Searched in the following locations: 找不到 com.android.tools.build:aapt2:3.2.0-4818971 - Could not find com.android.tools.build:aapt2:3.2.0-4818971 找不到aapt2-proto.jar(com.android.tools.build:aapt2-proto:0.3.1) - Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1) Android Studio 3.2 - 找不到com.android.tools.build:aapt2:3.2.0-4818971 - Android Studio 3.2 - Could not find com.android.tools.build:aapt2:3.2.0-4818971 Android Studio找不到com.android.tools.build:aapt2:3.2.0-4818971 - Android studio Could not find com.android.tools.build:aapt2:3.2.0-4818971 找不到 com.android.tools.build:gradle:4.0.0 - Could not find com.android.tools.build:gradle:4.0.0 找不到com.android.tools.build:aapt2:3.3.0-alpha08-4963834。 我收到此错误 - Could not find com.android.tools.build:aapt2:3.3.0-alpha08-4963834. I am getting this error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM