[英]Flutter build failed with D8: Program type already present
I am developing a flutter app.我正在开发一个颤振应用程序。
I found a sample flutter project so folk it.我找到了一个样本颤振项目,所以很受欢迎。 But the project... build failed with below log message.但是项目...构建失败并显示以下日志消息。
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution
* 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 0s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1
The project is not special.这个项目并不特别。 The android part, there are no other modifications. android部分,没有其他修改。 It is totally same with the "new flutter project'.这与“新的颤振项目”完全相同。
I tried something:我尝试了一些东西:
This is failed with error popup.这失败并弹出错误。 I tried to migration using "refactor > migration to android x", but it shows error popup.我尝试使用“重构 > 迁移到 android x”进行迁移,但它显示错误弹出窗口。 The error popup said to me use compilesdkversion at least 28. But I already use 28.. what should I do?......错误弹出窗口告诉我至少使用 compilesdkversion 28。但我已经使用了 28 .. 我该怎么办?......
But build failed with different log但是构建失败,日志不同
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Program type already present: android.support.v4.app.INotificationSideChannel
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:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
I don't know what should i do...我不知道我该怎么办...
It make me to tired... I just want to coding...这让我很累......我只想编码......
I resolve this issue following this link: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility我通过以下链接解决了这个问题: https : //flutter.dev/docs/development/packages-and-plugins/androidx-compatibility
There is 2 migration guide.有 2 个迁移指南。
Recommended受到推崇的
Not Recommended不建议
In my case, 'Recommended' solution doesn't work...就我而言,“推荐”解决方案不起作用......
But, 'Not recommended' solution works...但是,“不推荐”解决方案有效......
... ...
It's not easy...这是不容易的...
我试过这两行代码flutter clean
然后flutter run
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.