Error:Execution failed for task
Asked Answered
L

2

8

I get this problem when I use source code of Telegram in Android studio. So I use android studio preview 3.0.0 beta 2, gradle 4.1-all.zip, mainsdk:15. I did everything but it's not working properly.

Error is :

Error:Execution failed for task: TMessagesProj:transformDexArchiveWithExternalLibsDexMergerForDebug. java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

build.gradle file is :

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta4'
    }
}
apply plugin: 'com.android.application'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.android.support:support-v4:21.0.+'
    compile 'com.google.android.gms:play-services:3.2.+'
    compile 'net.hockeyapp.android:HockeySDK:3.5.+'
    compile 'com.googlecode.mp4parser:isoparser:1.0.+'
    compile 'com.android.support:recyclerview-v7:+'
}

android {
    compileSdkVersion 21
    buildToolsVersion '26.0.0'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    signingConfigs {
        debug {
            storeFile file("config/debug.keystore")
        }

        release {
            storeFile file("config/release.keystore")
            storePassword RELEASE_STORE_PASSWORD
            keyAlias RELEASE_KEY_ALIAS
            keyPassword RELEASE_KEY_PASSWORD
        }
    }

    buildTypes {
        debug {
            debuggable true
            jniDebuggable true
            signingConfig signingConfigs.debug
        }

        release {
            debuggable false
            jniDebuggable false
            //signingConfig signingConfigs.release
        }

        foss {
            debuggable false
            jniDebuggable false
            signingConfig signingConfigs.release
        }
    }

    sourceSets.main {
        jniLibs.srcDir 'libs'
        jni.srcDirs = [] //disable automatic ndk-build call
    }

    sourceSets.debug {
        manifest.srcFile 'config/debug/AndroidManifest.xml'
    }

    sourceSets.release {
        manifest.srcFile 'config/release/AndroidManifest.xml'
    }

    sourceSets.foss {
        manifest.srcFile 'config/foss/AndroidManifest.xml'
    }

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

    defaultConfig {
        applicationId "org.telegram.plus"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 458
        versionName "2.5.2.1"

    }
}

so gradle-wrapper.properties is services.gradle.org/distributions/gradle-4.1-all.zip

Logbook answered 8/9, 2017 at 14:25 Comment(2)
It seems that you use the old version. Have you try the newest one at github.com/DrKLO/Telegram?Torrence
Possible duplicate of Dex error On Android Studio 3.0 Beta4Willable
L
0

Try removing the line:

compile 'com.google.android.gms:play-services:3.2.+'

If that works. Replace it with the specific parts of play-services you need, e.g:

compile 'com.google.android.gms:play-services-gcm:11.2.0'

for Google Cloud Messaging.

Leakey answered 12/9, 2017 at 9:48 Comment(0)
H
0

Try the below it worked for me

  • Delete the ./gradle folder inside your project
  • Delete all the build folders and the gradle cache. I ran the following command:

based off Dex error On Android Studio 3.0 Beta4

Hines answered 14/9, 2017 at 12:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.