kit*_*fer 7 java xml android gradle android-studio
这是一个 Gradle 错误,当我运行空的“hello world”(从空 Activity 模板构建)而没有任何添加的代码时出现此错误,以下是错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> 6 issues were found when checking AAR metadata:
1. Dependency 'androidx.appcompat:appcompat-resources:1.6.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.0 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
2. Dependency 'androidx.appcompat:appcompat:1.6.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.0 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
Run Code Online (Sandbox Code Playgroud)
我将在这两个错误消息之后停止显示错误消息,因为我怀疑修复一个错误消息将修复所有六个错误消息。
下面是我的build.gradle (:app)
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.enetapplications.empty"
minSdk 28
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_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
Run Code Online (Sandbox Code Playgroud)
这个错误首先发生在构建应用程序时,我只使用 xml 并准备开始 java - 然后为了测试,我打开了一个空白的“空”项目并收到了完全相同的错误,因此似乎与 Android Studio 的方式有关正在配置中。
Ahm*_*met 11
将您的版本更新到 33,如下所示
compileSdk 33
defaultConfig {
applicationId "com.enetapplications.empty"
minSdk 28
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Run Code Online (Sandbox Code Playgroud)
小智 6
转到您的build.gradle(:app)
,增加您的compileSdk和targetSdk。在那里写:
compileSdk 33
targetSdk 33
Run Code Online (Sandbox Code Playgroud)
然后在顶部您将看到“立即同步”选项,单击它。现在你的问题已经解决了。
归档时间: |
|
查看次数: |
14902 次 |
最近记录: |