构建失败可能是由于插件中的 AndroidX 不兼容

Posted

技术标签:

【中文标题】构建失败可能是由于插件中的 AndroidX 不兼容【英文标题】:The built failed likely due to AndroidX incompatibilities in a plugin 【发布时间】:2021-07-13 20:19:05 【问题描述】:

Flutter 应用程序在调试模式下运行良好。发布应用时出错。

Running Gradle task 'assembleRelease'...                         1434.8s (!)
The built failed likely due to androidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin android_intent...
Running Gradle task 'assembleAarRelease'...                        93.5s


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android_intent'.

我尝试过的:

    删除了“android_intent”插件。删除后,cloud_firestore 仍然存在同样的问题。
                                                                                                                   
* What went wrong:                                                                                                 
Execution failed for task ':flutter_appavailability:verifyReleaseResources'.                                       
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade                  
   > Android resource linking failed                                                                               
     /home/mkmalik/.gradle/caches/transforms-2/files-2.1/fa16a5b23fa3b0f70fd87fe1ad317210/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
                                                                                                                   
     /home/mkmalik/.gradle/caches/transforms-2/files-2.1/fa16a5b23fa3b0f70fd87fe1ad317210/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.
                                                                                                                   
                                                                                                                   
* 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 6m 38s                                                                                             
Running Gradle task 'assembleRelease'...                                                                           
Running Gradle task 'assembleRelease'... Done                     407.1s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the
incompatibility.
Building plugin cloud_firestore...
The plugin cloud_firestore could not be built due to the issue above.
    将 Gradle 更新到 4.0.1 并将 compileSdkVersion 更新到 30。并成功发布了应用程序(来自本机代码的 7 个警告)。但在设备上,它会在一秒钟后立即停止(仅白屏)。

颤振 1.22.5

【问题讨论】:

【参考方案1】:

flutter_appavailability 存在问题。 刚刚删除并解决了问题。

【讨论】:

以上是关于构建失败可能是由于插件中的 AndroidX 不兼容的主要内容,如果未能解决你的问题,请参考以下文章

构建失败可能是由于插件中的 AndroidX 不兼容。该工具即将尝试使用Jetifier解决不兼容问题

Gradle 失败可能是因为这个 Flutter 应用程序中的 AndroidX 不兼容

由于 androidannotations 插件,Gradle 构建失败

由于 NDK 版本不兼容,Android 构建在 CI 中失败,但在本地不兼容

由于 androidx.core 库不匹配,无法构建项目

清单合并失败:属性 application@appComponentFactory - Androidx