首页 > 解决方案 > Flutter 闪屏 - 构建失败可能是由于插件中的 AndroidX 不兼容

问题描述

整个错误是这样的:

* Get more help at https://help.gradle.org

    BUILD FAILED in 14s
    The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
    Building plugin flutter_plugin_android_lifecycle...
    
    FAILURE: Build failed with an exception.

    * What went wrong:
    Task 'assembleAarRelease' not found in root project 'flutter_plugin_android_lifecycle'.
    
    * Try:
    Run gradlew tasks to get a list of available tasks. 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 1s
    
    Exception: The plugin flutter_plugin_android_lifecycle could not be built due to the issue above

至少我尝试将颜色从白色更改为蓝色;

<item android:drawable="@android:color/blue" />

还尝试创建一个 colors.xml 文件并将上面的行更改为:

<item android:drawable="@color/background" />

但同样的错误。我的 sdk 编译版本是 30,目标版本也是 30,minsdk 版本是 16,但在出现此错误后尝试将其更改为 19,但没有帮助。

标签: androidflutter

解决方案


确保flutter是flutter_plugin_android_lifecycle包的升级或更低版本


推荐阅读