我正在尝试运行这个现成的应用程序,但它不起作用,所以我必须更新 AGP。这样做之后,我不断收到此错误。我是 Dart 和 Android 的新手,所以...... 如果您需要更多信息,请告诉我,我包含了我正在使用的版本。
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
> An issue was found when checking AAR metadata:
1. Dependency ':flutter_local_notifications' requires core library desugaring to be enabled
for :app.
See https://developer.android.com/studio/write/java8-support.html for more
details.
* 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.
BUILD FAILED in 2s
扑医生-v
[√] Flutter (Channel stable, 3.10.0, on Microsoft Windows [Version 10.0.22631.4317], locale en-US)
• Flutter version 3.10.0 on channel stable at C:\flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 84a1e904f4 (1 year, 6 months ago), 2023-05-09 07:41:44 -0700
• Engine revision d44b5a94c9
• Dart version 3.0.0
• DevTools version 2.23.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\Arwa\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
[√] VS Code (version 1.95.1)
• VS Code at C:\Users\Arwa\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.100.0
[√] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4317]
• Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.112
• Edge (web) • edge • web-javascript • Microsoft Edge 130.0.2849.68
[√] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
我尝试了一些解决方案,例如this但没有任何效果。
在您的
android/app/build.gradle
中添加coreLibraryDesugaring
内dependencies
:
dependencies {
// Add this [coreLibraryDesugaring] inside [dependencies]
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
}
这将启用核心库脱糖。