Published on 10/18/2021
Published by Pratik Takle
Changes made to remove kotlin multiple classes issue
-
The issue was :
123456789101112131415161718192021222324252627282930313233343536373839404142 > Task :app:checkReleaseDuplicateClasses FAILEDw: Detected multiple Kotlin daemon sessions at build\kotlin\sessionsFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:checkReleaseDuplicateClasses'.> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable> Duplicate class com.google.android.gms.internal.measurement.zzbs found in modules jetified-play-services-measurement-18.0.2-runtime (com.google.android.gms:play-services-measurement:18.0.2) and jetified-play-services-measurement-sdk-api-18.0.3-runtime (com.google.android.gms:play-services-measurement-sdk-api:18.0.3)Duplicate class com.google.android.gms.internal.measurement.zzl found in modules jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2) and jetified-play-services-measurement-sdk-api-18.0.3-runtime (com.google.android.gms:play-services-measurement-sdk-api:18.0.3)Duplicate class com.google.android.gms.measurement.internal.zzfh found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)Duplicate class com.google.android.gms.measurement.internal.zzgn found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)Duplicate class com.google.android.gms.measurement.internal.zzgo found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)Duplicate class com.google.android.gms.measurement.internal.zzgp found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)Duplicate class com.google.android.gms.measurement.internal.zzgq found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)Duplicate class com.google.android.gms.measurement.internal.zzhs found in modules jetified-play-services-measurement-18.0.2-runtime (com.google.android.gms:play-services-measurement:18.0.2) and jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3)Duplicate class com.google.android.gms.measurement.internal.zzhx found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.* 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 <a tabindex="-1" title="https://help.gradle.org/" href="https://help.gradle.org/" target="_blank" rel="noopener noreferrer" aria-label="Link https://help.gradle.org">https://help.gradle.org</a>Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.Use '--warning-mode all' to show the individual deprecation warnings.See <a tabindex="-1" title="https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings" href="https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings" target="_blank" rel="noopener noreferrer" aria-label="Link https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings">https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings</a>BUILD FAILED in 5m 26s449 actionable tasks: 396 executed, 53 up-to-dateerror Command failed with exit code 1.info Visit <a tabindex="-1" title="https://yarnpkg.com/en/docs/cli/run" href="https://yarnpkg.com/en/docs/cli/run" target="_blank" rel="noopener noreferrer" aria-label="Link https://yarnpkg.com/en/docs/cli/run">https://yarnpkg.com/en/docs/cli/run</a> for documentation about this command.
-
Solution
- Note: Update or add only those dependencies which are needed in your project.
- update your pkg manager to their latest version*
- yarn : 1.22.5
- npm : 6.14.15
- upgrade your gradle to latest version* i.e Gradle 7.2
- android\gradle.properties-
- adjust head memory changes
- default
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - updated
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
- android\gradle\wrapper\gradle-wrapper.properties
- check gradle version as gradle-6.9-all.zip
- android\build.gradle
- changes are “**” marked
- buildscript {
- ext {
- **buildToolsVersion = “30.0.2”
- **minSdkVersion = 21
- **compileSdkVersion = 30
- **targetSdkVersion = 30
- **kotlinVersion = “1.3.72” // add this line
- }
- repositories {
- google()
- **mavenCentral()
- jcenter()
- }
- dependencies {
- **classpath ‘com.android.tools.build:gradle:4.2.0’
- **classpath ‘com.google.gms:google-services:4.3.3’
- // add this line
**classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion” - classpath ‘com.google.firebase:firebase-crashlytics-gradle:2.2.0’
- }
- ext {
- }
- allprojects {
- repositories {
**mavenCentral() - }
- repositories {
- }
- android\app\build.gradle
- defaultConfig {
- **versionCode 21093001
//** versionCode- first 2 digit – year (21)
- next 2 digit – month (01 – 12)
- next 2 digit – date (01 – 31)
- last 2 digit – attempt made to compile same apk **//
- **versionName “2.0.2”
- multiDexEnabled true
- **versionCode 21093001
- }
-
**dexOptions {incremental truejavaMaxHeapSize “4g”}
- repositories {
- // For facebook-android-sdk
**mavenCentral()
jcenter()
- // For facebook-android-sdk
- }
- dependencies {
- **implementation ‘com.facebook.android:facebook-android-sdk:[8,9)’
- **implementation “com.google.firebase:firebase-analytics:19.0.0”
- **implementation ‘com.google.android.gms:play-services-safetynet:17.0.1’
- }
- defaultConfig {
- package.json
-
- “dependencies”: {
- **”react”: “^16.14.0”,
- **”react-dom”: “^16.13.1”,
- **”react-native”: “0.63.4”,
- }
- “dependencies”: {
-