【问题标题】:Adding multidex support to Flutter为 Flutter 添加 multidex 支持
【发布时间】:2019-03-28 13:15:51
【问题描述】:

我正在使用 Flutter 构建我的应用程序。现在我总是收到这个错误:

FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug',> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: ...The number of method references in a .dex file cannot exceed 64K.Learn how to resolve this issue: https://developer.android.com/tools/building/multidex.html* 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 32s Finished with error: Gradle build failed: 1

所以这个错误清楚地表明我必须添加multidex-support。但是如何在 FLUTTER 中做到这一点呢?

【问题讨论】:

标签: error-handling flutter android-multidex


【解决方案1】:

问题不在于 Firebase 或 Firestore - 它是您添加到应用程序的依赖项的数量,您需要启用 Multidex - 关于如何在线执行此操作的一些步骤Flutter multidex problem With FirebaseAuth , Firestore and Google Sign in

【讨论】:

    【解决方案2】:

    Android 5.0 之前的平台版本使用 Dalvik 运行时来执行应用代码。默认情况下,Dalvik 将应用程序限制为每个 APK 单个 classes.dex 字节码文件。为了绕过这个限制,您可以将 multidex 支持库添加到您的项目中:

    依赖{ def multidex_version = "2.0.1" 实现 'androidx.multidex:multidex:$multidex_version' }

    要查看此库的当前版本,请参阅版本页面上有关 Multidex 的信息。

    如果您不使用 AndroidX,请添加以下支持库依赖项:

    依赖{实现'com.android.support:multidex:1.0.3'}

    【讨论】:

      【解决方案3】:

      最后,我通过删除 CloudFirestore 实现来修复它。当时好像有版本bug。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-04-21
        • 2015-02-05
        • 1970-01-01
        • 1970-01-01
        • 2020-01-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多