这是我的Android/build.gradle代码Android Mobile应用程序。但是我在这里有一个错误。我什么都不了解。你能帮我吗?
build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
失败:构建失败,有例外。
- 出了什么问题:
执行失败的任务':app:checkdebugaarmetadata'。
发生多个任务动作失败:
执行com.android.build.gradle.internal.tasks.checkaarmetadataworkaction时发生故障
> Mincompilesdk(31)在
依赖项的AAR元数据(Meta-Inf/com/android/build/gradle/aar-metadata.properties)
大于该模块的CompileSdkversion(Android-30)。
依赖项:androidx.window:window-java:1.0.0-beta04。
aar metadata文件:c:\ users \ berfi.gradle \ caches \ transforms-2 \ first-2.1 \ 5695D8D932D545AF38BF66B725566D02 \ -metadata.properties。
执行com.android.build.gradle.internal.tasks.checkaarmetadataworkorcation时发生故障
> Mincompilesdk(31)在
依赖项的AAR元数据(Meta-Inf/com/android/build/gradle/aar-metadata.properties)
大于该模块的CompileSdkversion(Android-30)。
依赖项:androidx.window:窗口:1.0.0-beta04。
aar metadata文件:c:\ users \ berfi.gradle \ caches \ transforms-2 \ files-2 \ files-2.1 \ e4e324fde2799cc82a9b6d2e3e16efc2 .properties。
This is my android/build.gradle code from city travel guide android mobile application. But I have an error for here. I don't understand anything. Can you help me for this?
build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
Multiple task action failures occurred:
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.window:window-java:1.0.0-beta04.
AAR metadata file: C:\Users\berfi.gradle\caches\transforms-2\files-2.1\5695d8d932d545af38bf66b725566d02\jetified-window-java-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.window:window:1.0.0-beta04.
AAR metadata file: C:\Users\berfi.gradle\caches\transforms-2\files-2.1\e4e324fde2799cc82a9b6d2e3e16efc2\jetified-window-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties.
-
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
-
Get more help at https://help.gradle.org
BU�LD FAILED in 2m 56s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
发布评论
评论(1)
有两个 build.gradle 文件。一个在root android/文件夹中,一个在 android/app/文件夹中。
从错误中了解 build.gradle file android/app/build.gradle ,然后更改31的 mincompilesdk 的值到30。默认值可以为 flutter.compilesdkversion 在这种情况下,也可以做同样的事情。用30替换它的
错误是“依赖关系中指定的MinCompilesdk(31)(31)(Meta-Inf/com/android/android/build/gradle/aar-metadata.properties)大于该模块的CompileSdkversion(Android-30) 。”
因此,我假设将其从31更改为30应该解决您的错误。尝试一下。
There are two build.gradle files. One in the root android/ folder and one in android/app/ folder.
From what I understand from the error go to build.gradle file inside android/app/build.gradle and change the value of minCompileSdk from 31 to 30. The default value could be flutter.compileSdkVersion in that case, do the same. Replace it with 30
The error is that "The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30)."
So I'm assuming changing it from 31 to 30 should fix your error. Give it a try.