2

I'm struggling to fix the problem that Android Studio Unable to create debug or signed apk.

Task :app:multiDexListDebug FAILED
Task :app:multiDexListDebug in app Finished
:app:multiDexListDebug (Thread[Daemon worker Thread 2,5,main]) completed. Took 2.62 secs.
AAPT2 aapt2-3.5.2-5435860-linux Daemon #0: shutdown

FAILURE: Build failed with an exception.

What went wrong:

Execution failed for task ':app:multiDexListDebug'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
    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: kotlin.StandardKt__SynchronizedKt

Scenario tried:

  • enabled multidex true
  • added dependency Multidex 2.0.1(android x)
  • cleaning and rebuild project
  • excluding org.jetbrains.kotlin from the major projects.
  • tried using api & runtimeOnly
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • 1
    **Program type already present:** These errors mostly appear when there are two instances of libraries on a single project that conflicts with each other. Run `gradlew app:dependencies` (on Linux: `./gradlew app:dependencies`) to see your dependency tree and search for **kotlin.StandardKt__SynchronizedKt** and see how many times and where it appears. Removing one instance should solve this problem. – Furkan Yurdakul Nov 27 '19 at 06:44
  • Possible duplicate of https://stackoverflow.com/questions/59063596/unable-to-create-debug-or-signed-apk – Muhammed Yalçın Kuru Nov 27 '19 at 07:00
  • @FurkanYurdakul I tried using the cmd `./gradlew app: dependencies` and searched for **kotlin.StandardKt__SynchronizedKt** I didn't find it – Verdant Clock Web Nov 28 '19 at 07:51
  • @Muhammed Yalcin Kuru Yes, the issue is similar as you posted. Not getting any leads at my end – Verdant Clock Web Nov 28 '19 at 07:56

1 Answers1

0

Once include the below code in your app level build.gradle and check

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
}
Vijaya Varma Lanke
  • 603
  • 2
  • 7
  • 19