【发布时间】:2021-08-29 22:03:47
【问题描述】:
自从我更新了 Flutter 后,我在使用 Gradle 编译 Flutter 应用程序时遇到了一些问题。
这是我的设置:
[√] Flutter (Channel stable, 2.2.2, on Microsoft Windows [version 10.0.18363.1198], locale fr-FR)
• Flutter version 2.2.2 at C:\Users\barba\Documents\flutter
• Framework revision d79295af24 (2 days ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\barba\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
这是我尝试编译时得到的日志。
Launching lib\main.dart on HD1900 in debug mode...
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: C:/Users/barba/.gradle/caches/transforms-2/files-2.1/24fa3aa8d2270e5eb067bbe36e9b7563/jetified-kotlin-stdlib-1.5.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
[...]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':audioplayers:compileDebugKotlin'.
> Compilation error. See log 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 21s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
我尝试从我的 Android 文件夹中删除 .gradle,并使用 gradlew clean。
这就是我得到的:
> Configure project :audio_session
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1s
11 actionable tasks: 11 up-to-date
但是我确实检查了我的 gradle.properties,没有 android.enableR8=true。我的整个项目文件夹中不存在此字符串,无法从 gradle 属性中删除它。
关于如何解决这个问题的任何想法? 谢谢
【问题讨论】: