android - Flutter 无法合并 dex
问题描述
我正在使用最新版本的颤振。
错误 :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUİLD FAILED in 3s
Finished with error: Gradle build failed: 1
pubspec.yaml 依赖项,使用 firebase_auth ^0.5.20 :
dependencies:
flutter:
sdk: flutter
intl: ^0.15.7
cloud_firestore: ^0.7.3
firebase_database: ^1.0.4
cached_network_image: ^0.4.2
firebase_auth: ^0.5.20
cupertino_icons: ^0.1.2
android app build.gradle 默认配置:
android{
defaultConfig {
applicationId "com.example.flutterapp"
minSdkVersion 21
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
}
解决方案
尝试添加依赖项
...
android {
...
defaultConfig {
...
multiDexEnabled true
}
...
}
...
dependencies {
implementation 'com.android.support:multidex:1.0.3' // use latest version
...
}
...
也可以看看
推荐阅读
- html - 将 R 文件编译成 HTML:data.frame(x,y) 中的错误:找不到 p
- mysql - 如何为每个父母收集最多记录
- javascript - 用 array.map() 中的渲染数据反应 js 问题
- r - R - 按字符迭代地选择和重命名列
- html - 为什么此 html 页面的完整内容未显示
- python - Python timeit.timeit - 排序的片段版本比使用 lambda 运行得更快,为什么?
- go - 使用 JWT 的 GraphQL Golang 身份验证
- javascript - Next.js:react-color - 警告:道具`style`不匹配
- angular - 如何确保用户输入图像(FORM ANGULAR)
- c - 如何在退出 C 中的 Do While 循环后使用在 Do While 循环中输入的值