找不到 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)
我在新设备上安装了 android studio,并从 android studio 模板开始了一个新项目。但是当我想 运行 设备上的应用程序时,构建过程失败并显示此消息:
Could not find 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
这是我的 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
这是我的 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'
}
我看到过类似的问题,但没有一个有帮助,两个最相关的帖子是 and Could not find com.android.tools.build:aapt2:3.2.0 正如您在我提供的文件中看到的那样,无法解决我的问题,因为解决方案已经实施.
**编辑:
当我点击 link 时,在浏览器上下载了一个 jar 文件,所以这不是互联网连接问题
我的解决方案是将 android studio 降级到 3.6.1。为了完成这项工作,我也需要降级 gradle。所以我将它降级到 5.6.4。所以我的 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
然后我对 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
}
**注意:
请注意,这只是一种变通方法,我找不到合适的理由,因此找不到合适的解决方案!
我在新设备上安装了 android studio,并从 android studio 模板开始了一个新项目。但是当我想 运行 设备上的应用程序时,构建过程失败并显示此消息:
Could not find 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
这是我的 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
这是我的 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'
}
我看到过类似的问题,但没有一个有帮助,两个最相关的帖子是
**编辑: 当我点击 link 时,在浏览器上下载了一个 jar 文件,所以这不是互联网连接问题
我的解决方案是将 android studio 降级到 3.6.1。为了完成这项工作,我也需要降级 gradle。所以我将它降级到 5.6.4。所以我的 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
然后我对 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
}
**注意:
请注意,这只是一种变通方法,我找不到合适的理由,因此找不到合适的解决方案!