android-studio - 当我创建一个“空的撰写活动”项目并单击运行时,它给了我以下错误
问题描述
当我创建一个empty compose activity
项目并单击运行时,它给了我以下错误
:app:checkDebugAarMetadata 和检查 AAR 元数据值时发现的一个或多个问题:
在大黄蜂 2021.1.1 beta 2
我将向您展示我的 build.gradles:我的 build.gradle 项目:
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
}
我的 build.grade 模块:
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
有谁知道问题是什么?
解决方案
首先,帮助>检查更新>更新并重新启动
如果更新成功,gradle插件会自动更新(否则会提示更新)
接下来,检查 Web 以获取与您的 compose 版本一起使用所需的 Kotlin 编译器版本。Compose 版本将在您的项目级构建(.gradle 文件)中定义,然后在同一文件中更新 Kotlin 版本(如果找不到,请告诉我)。
然后,只需将项目与 Gradle 同步,您就不会再收到错误消息了。此外,还有一件事也有帮助,那就是尝试使用 --scan 运行构建,它会在 logcat 窗口中记录完整的输出。查看 Android Studio 中的构建选项卡,并找到一条带有蓝色链接“使用 --scan 运行”的行。只需单击它,然后搜索生成的日志以获取确切的错误消息。这将帮助您明确您的问题并吸引更多的回答者来帮助您。
推荐阅读
- javascript - 在 JS 中哪一个有意义:通过 foreach 搜索对象集合中的值与使用不同键保持多个集合
- c - C 风格编码和动态数组
- javascript - 使用 JavaScript 为可用于特定类的按钮创建函数
- matlab - 获取输入参数不足错误
- python - 在 Pandas 数据框中用 0 填充缺失年份/季度的列
- bash - 用于在其他目录中运行命令的 Bash 脚本,无论级别如何
- shell - 用户指定的变量作为 shell 脚本循环中的计数器
- python - 如何从我的下载文件夹中以文件夹的形式安装 Python 包?
- ansible - ansible 多个 with_items 并在清单组中的所有主机上循环
- r - 计算数据框中常见的、互斥的元素