1、
![](https://img.haomeiwen.com/i1938800/19cc262634443b94.png)
这个错误的意思是您当前的构建配置中使用的Java版本(Java 17.0.6)与您的Gradle版本(5.1.1)不兼容。Gradle 5.1.1并不支持Java 17,因为Java 17是在该版本Gradle发布后才出现的。
打开gradle-wrapper.properties文件,将distributionUrl更改为支持Java 17的Gradle版本,如7.2或更高。
或者打开File->Rroject Structure->SDK Location,降低Gradle JDK版本。
2、
An issue was found when checking AAR metadata:
1. Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that
depend on it to compile against version 34 or later of the
Android APIs.
:app is currently compiled against android-33.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 34.
Note that updating a library or application's compileSdk (which
allows newer APIs to be used) can be done separately from updating
targetSdk (which opts the app in to new runtime behavior) and
minSdk (which determines which devices the app can be installed
on).
从这段信息告诉我们,升级SDK这个是必须的,除非你不用。
解决方法:
(1)升级SDK:app/build.gradle中将 compileSdk 和 targetSdk 升至 34 即可。
(2)降低版本:将1.11.0改为1.8.0即可
dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
// implementation("com.google.android.material:material:1.11.0")
implementation("com.google.android.material:material:1.8.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")
}
网友评论