Flutter:如果Cloud_firestore或其依赖项与AndroidX不兼容,Cloud_firestore将破坏您的Android构建 [英] Flutter: Cloud_firestore will break your Android build if it or its dependencies aren't compatible with AndroidX

查看:139
本文介绍了Flutter:如果Cloud_firestore或其依赖项与AndroidX不兼容,Cloud_firestore将破坏您的Android构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I can not use these both flutter plugins together:

  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手机上编译并运行.但是两者不能一起走.如何解决?

it compiled and runned on Android phone when I remove one of them. But both can not go together. How to fix?

推荐答案

简而言之

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

Add multidex library to android app dependency (/android/app/build.gradle)

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

在android目录下gradel.properties文件

under android directory gradel.properties file

添加

android.useAndroidX=true
android.enableJetifier=true

这篇关于Flutter:如果Cloud_firestore或其依赖项与AndroidX不兼容,Cloud_firestore将破坏您的Android构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆