【发布时间】:2019-07-21 12:25:31
【问题描述】:
我已将 simple_permissions 依赖项添加到我正在开发的颤振应用程序中,但添加后应用程序将无法构建并出现下一个错误:
Launching lib\main.dart on LG M700 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.
* 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
我已经有了这个依赖:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
path: ^1.6.2
path_provider: ^0.5.0+1
open_file: ^1.2.2+2
这可以正常编译,但在添加 simple_permissions: ^0.1.9 后,应用程序将无法编译。我已经尝试了一些需要更改 build.gradle 文件的解决方案,但它们也没有奏效,例如将 sdk 版本从 27 更改为 28 并添加这段代码:
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
}
}
由于构建无法生成 dex 列表。
我正在使用 vscode 开发应用程序并在我的智能手机上运行该应用程序。
如果您能帮我解决这个问题,我将不胜感激。
【问题讨论】:
-
看来你需要启用multidex developer.android.com/studio/build/multidex
标签: android visual-studio-code flutter