构建失败,并发生以下异常:任务':app:transformClassesWithMultidexlistForDebug'的执行失败

时间:2019-01-25 19:58:44

标签: android android-studio android-gradle build.gradle android-build

我在执行项目时遇到问题,我刚刚从git下载了该项目,但似乎不适用于我的Android Studio版本。该项目是使用Android的27 SDK编译版本创建的。

我尝试了许多不同的解决方案,但没有任何效果。这是我已经尝试过的东西:

  1. 更改编译版本

compileSdkVersion更改为28

  1. 将dexOption设置为false到库

为库添加dexOption

dexOptions {
        preDexLibraries = false
    }
  1. 执行gradle的androidDependencies测试,它会成功构建。

就像我说的那样,这些都不起作用,但是我在运行构建测试时发现了一个问题。

enter image description here

测试给了我这个错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

这是我的毕业文件:

build.gradle

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

    }
}

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

build.gradle(模块:应用)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 'android-28'
    useLibrary  'org.apache.http.legacy'
    defaultConfig {
        applicationId "myIdApplication"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    jcenter()
    google()
    maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' }
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.github.chrisbanes:PhotoView:latest.release'
    implementation 'com.android.support:animated-vector-drawable:27.1.1'
    implementation('com.mikepenz:materialdrawer:5.9.1@aar') { transitive = true }
    implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.twitter.sdk.android:twitter:3.1.1'
    implementation 'com.twitter.sdk.android:twitter-core:3.1.1'
    implementation 'com.twitter.sdk.android:tweet-ui:3.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'com.hendraanggrian:recyclerview-paginated:0.6'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.android.support:design:27.1.1'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'commons-codec:commons-codec:1.11'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
    implementation 'com.synnapps:carouselview:0.1.4'
    implementation 'bg.devlabs.fullscreenvideoview:library:0.0.8'
    implementation 'com.github.halilozercan:BetterVideoPlayer:1.2.alpha1'
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'
    implementation 'com.mindorks.android:prdownloader:0.4.0'
    testImplementation 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:exifinterface:27.1.1'

}

我这个问题在Google上已经存在了几天,但没有任何效果。 预先感谢。

0 个答案:

没有答案