1

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. It is totally same with the "new flutter project'.

I tried something:

  1. Migration to AndroidX

This is failed with error popup. I tried to migration using "refactor > migration to android x", but it shows error popup. The error popup said to me use compilesdkversion at least 28. But I already use 28.. what should I do?......

  1. change gradle version from 3.2.1 to 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...

yoonhok
  • 2,575
  • 2
  • 30
  • 58
  • Try take a look at [this](https://stackoverflow.com/questions/54771498/d8-program-type-already-present-android-support-v4-media-mediabrowsercompatcu/54773290#54773290) – Marcos Boaventura Apr 09 '19 at 16:46

2 Answers2

1

I resolve this issue following this link: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility

There is 2 migration guide.

  1. Recommended

  2. Not Recommended

In my case, 'Recommended' solution doesn't work...

But, 'Not recommended' solution works...

...

It's not easy...

yoonhok
  • 2,575
  • 2
  • 30
  • 58
0

I tried this two lines of code flutter clean and then flutter run