When I create an empty compose activity
project and click run it gives me the following error
:app:checkDebugAarMetadata and One or more issues found when checking AAR metadata values:
in Bumblebee 2021.1.1 beta 2
I’ll show you my build.gradles:
My build.gradle project:
buildscript {
ext {
compose_version = '1.1.0-beta01'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.0-alpha03' apply false
id 'com.android.library' version '7.2.0-alpha03' apply false
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My build.grade module:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.example.myapplication"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}
gradle-wrapper.properties:
#Sun Oct 31 22:07:49 BRT 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https://services.gradle.org/distributions/gradle-7.3-rc-1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Kotlin plugin version 212-1.5.31-realase-556-AS4638.7
Does anyone know what the problem is?
2
Answers
Update your Compose to the latest version or try one of the beta versions. Also, make sure you’re using the correct gradle plugin version. The Kotlin compiler must also match. And use the correct Compose dependency versions. When using beta versions of Android Studio, you need to make sure these plugins and dependencies are set correctly. Don’t rely on the Compose project template setting these.
EDIT:
Try this:
After making these changes, try and run the app. If it still fails, make these changes to (but only after changing the above fails):
If none of this works, try downgrading from Bumblebee to an earlier version such as Arctic Fox and then increase to beta 1
First of all, Help > Check for Updates > Update and Restart
If it updates successfully, the gradle plugin will automatically be updated (or you will be prompted to update)
Next, check the web for the Kotlin Compiler version Required to work with your compose verision. Compose version will be defined in your project-level build (.gradle file), then update the Kotlin version in the same file (if you don’t find it, let me know).
Then, just Sync Project with Gradle and you should not receive the error any more. Also, one more thing that also helps, is trying to run the build with –scan, which logs full output in the logcat window. See the build tab in Android studio and find a line that has a link ‘run with –scan’ in blue. Just click on it, then search through the produced logs to obtain the exact error message. This will help you be specific about your issue and attract more answerers to your rescue.