原因:org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException:执行com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction时发生失败 我在运行应用程序时收到此错误,我不知道为什么。 帮忙!
buld.gradle(模块:应用程序)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
namespace 'com.example.adore'
compileSdk 32
defaultConfig {
applicationId "com.example.adore"
minSdk 24
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.annotation:annotation:1.6.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'com.google.firebase:firebase-auth:22.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
build.gradle(项目)
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.0' apply false
id 'com.android.library' version '8.1.0' apply false
id 'com.google.gms.google-services' version '4.3.15' apply false
}
首先升级这个:
安卓{ 命名空间“com.asgar72.todoapp” compileSdk 34 //升级这个最新的sdk
defaultConfig {
applicationId "com.asgar72.todoapp"
minSdk 25
targetSdk 33 //Latest sdk
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
最终工作是: 在 build.gradle(Module:app) 中添加以下行 依赖项{
(...)
// 修复重复的类 实现(平台(“org.jetbrains.kotlin:kotlin-bom:1.8.0”))
}