简体   繁体   English

错误:任务执行失败

[英]Error:Execution failed for task

I get this problem when I use source code of Telegram in Android studio.当我在 Android Studio 中使用 Telegram 的源代码时,我遇到了这个问题。 So I use android studio preview 3.0.0 beta 2, gradle 4.1-all.zip, mainsdk:15.所以我使用 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.错误:任务执行失败:TMessagesProj:transformDexArchiveWithExternalLibsDexMergerForDebug。 java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: 无法合并 dex

build.gradle file is : build.gradle文件是:

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所以gradle-wrapper.propertiesservices.gradle.org/distributions/gradle-4.1-all.zip

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, eg:将其替换为您需要的游戏服务的特定部分,例如:

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

for Google Cloud Messaging.用于 Google 云消息传递。

Try the below it worked for me试试下面的它对我有用

  • Delete the ./gradle folder inside your project删除项目中的 ./gradle 文件夹
  • Delete all the build folders and the gradle cache.删除所有构建文件夹和 gradle 缓存。 I ran the following command:我运行了以下命令:

based off Dex error On Android Studio 3.0 Beta4基于Android Studio 3.0 Beta4 上的 Dex 错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:任务“:app:transformClassesWithMultidexlistForDebug”的执行失败 - Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug' 错误:运行时任务 ':app:dexDebug' 执行失败 - Error:Execution failed for task ':app:dexDebug' at runtime 错误:任务“:app:mergeDebugResources”的执行失败。 - Error:Execution failed for task ':app:mergeDebugResources'. Android Studio:错误:任务执行失败 - Android Studio: Error:Execution failed for task 错误:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败。 > - Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > 任务':app:mergeDebugResources'的错误_Execution失败 - Error _Execution failed for task ':app:mergeDebugResources' 错误:任务':app:compileDebugAidl'的执行失败 - Error:Execution failed for task ':app:compileDebugAidl' 错误:任务':app:dexDebug'的执行失败。 在Android中 - Error:Execution failed for task ':app:dexDebug'. in android 错误:任务':app:transformClassesAndResourcesWithProguardForRelease的执行失败 - Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease 错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug的执行失败 - Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM