gpt4 book ai didi

Flutter:如果 Cloud_firestore 或其依赖项与 AndroidX 不兼容,Cloud_firestore 将破坏您的 Android 构建

转载 作者:IT王子 更新时间:2023-10-29 07:22:43 24 4
gpt4 key购买 nike

我不能同时使用这两个 flutter 插件:

  cloud_firestore: ^0.9.0+2
barcode_scan: ^0.0.8

运行时出现错误:

D8: Program type already present: android.arch.core.util.Function
*********************************************************
WARNING: This version of cloud_firestore will break your Android build if it or its dependencies aren't compatible with AndroidX.
See https: //goo.gl /CP92wY for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************

FAILURE: Build failed with an exception.

当我删除其中一个时,它在 Android 手机上编译并运行。但两者不能并存。如何修复?

最佳答案

简而言之

将 multidex 库添加到 android 应用依赖项 (/android/app/build.gradle)

...
android {
...
defaultConfig {
...
multiDexEnabled true
}
...
}
...
dependencies {
implementation 'com.android.support:multidex:1.0.3' // use latest version
...
}
...

android目录下gradel.properties 文件

添加

android.useAndroidX=true
android.enableJetifier=true

关于Flutter:如果 Cloud_firestore 或其依赖项与 AndroidX 不兼容,Cloud_firestore 将破坏您的 Android 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54801856/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com