简体   繁体   English

Flutter 构建失败,D8:程序类型已经存在

[英]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:我尝试了一些东西:

  1. Migration to AndroidX迁移到 AndroidX

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 .. 我该怎么办?......

  1. change gradle version from 3.2.1 to 3.3.2.将 gradle 版本从 3.2.1 更改为 3.3.2。

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 个迁移指南。

  1. Recommended受到推崇的

  2. 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.

相关问题 迁移至Gradle 3.0.0:错误-D8:程序类型已存在 - Migrating to Gradle 3.0.0: Error - D8: Program type already present Unity3d Admob 集成破坏了 Android Build:“D8:程序类型已经存在:android.support.customtabs.ICustomTabsCallback” - Unity3d Admob integration breaks Android Build: "D8: Program type already present: android.support.customtabs.ICustomTabsCallback" React 本机发行版本构建失败,D8:程序类型已经存在:com.reactnativecommunity.webview.BuildConfig - React native release version build fails with D8: Program type already present: com.reactnativecommunity.webview.BuildConfig D8:程序类型已经存在:org.apache.cordova.BuildHelper - D8: Program type already present: org.apache.cordova.BuildHelper D8:程序类型已经存在:android.support.v4.media.MediaBrowserCompat$CustomActionCallback - D8: Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback D8:程序类型已经存在:android.support.v4.app.INotificationSideChannel$Stub$Proxy - D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy 构建失败:程序类型已存在 - Build Failed: Program Type Already Present AGPBI:{“kind”:“错误”,“文字”:“程序类型已存在:com.google.common.annotations.GwtCompatible”,“来源”:[{}],“工具”:“D8”} - AGPBI: {“kind”:“error”,“text”:“Program type already present: com.google.common.annotations.GwtCompatible”,“sources”:[{}],“tool”:“D8”} Android Studio Gradle Build失败错误:程序类型已存在 - Android Studio Gradle Build Failed Error: Program type already present 任务程序类型已执行的执行失败? - Execution failed for task Program type already present?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM