无法制作或构建项目:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败

时间:2019-08-02 04:14:13

标签: android gradle picasso android-glide

一切正常。在我的应用程序中,我使用的是Picasso来显示图像,默认情况下,Picasso会将图像旋转90度。我想用Glide代替,我尝试将Glide包含在项目中。从那时起,即使我从项目中删除了Glide,也遇到了这个错误,我无法再构建项目了。这是我的格雷尔斯。

Project.gradle

buildscript {
repositories {
    google()
    maven {
        url "https://maven.google.com"
    }
    maven {
        url 'https://maven.fabric.io/public'
    }
    jcenter()
}
dependencies {

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.android.tools.build:gradle:3.4.2'
    classpath 'com.google.gms:google-services:4.2.0'
    classpath 'io.fabric.tools:gradle:1.31.0'
}

}

allprojects {
repositories {
    google()
    maven { url "https://maven.google.com" }
    maven { url "https://jitpack.io" }
    jcenter()
}


}


task clean(type: Delete) {
    delete rootProject.buildDir
}

App.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "xxx"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 40
        versionName "0.0.97"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions
            {
                sourceCompatibility JavaVersion.VERSION_1_8
                targetCompatibility JavaVersion.VERSION_1_8
            }
    dexOptions {
        javaMaxHeapSize "8g"
    }
    useLibrary 'org.apache.http.legacy'
}

repositories {
    maven { url "https://jitpack.io" }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.google.firebase:firebase-inappmessaging-display:18.0.1'
    implementation 'com.google.firebase:firebase-dynamic-links:18.0.0'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'gun0912.ted:tedpermission:2.2.2'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.github.BlacKCaT27:CurrencyEditText:2.0.2'
    implementation 'com.github.CardinalNow:Android-CircleProgressIndicator:v0.2'
    implementation 'com.txusballesteros:FitChart:1.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

请帮助。

3 个答案:

答案 0 :(得分:0)

尝试一下: 转到文件 >> 使缓存无效并重新启动。

如果没有帮助,请手动尝试以下操作:

关闭Android Studio

转到C:\ Users \ UserName \ .android并重命名:

  • build-cache文件夹到build-cache.bak

转到C:\ Users \ UserName \ .AndroidStudio3.4.2 \ system并重命名这些文件夹:

  • 缓存到caches.bak

  • 编译到compile.bak

  • 从编译服务器到compile-server.bak

  • 转换为conversion.bak

  • external_build_system到external_build_system.bak

  • 构架到frameworks.bak

  • 渐变为gradle.bak

  • resource_folder_cache到resource_folder_cache.bak

打开Android Studio,然后再次打开您的项目。希望对您有所帮助。

答案 1 :(得分:0)

1-添加

android {
      defaultConfig {
        multiDexEnabled true
        }
   }
  • 同步项目
  • 清洁
  • 构建

答案 2 :(得分:0)

尝试添加这两个依赖项,让我知道,

implementation "android.arch.core:runtime:1.1.0"
implementation "android.arch.core:common:1.1.0"