0

我已经尝试了所有可能的方法来解决 MultidexlistForDebug 问题,但我仍然卡住了请检查我的 gradle 文件

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0"
//    useLibrary  'org.apache.http.legacy'
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }




defaultConfig {

        applicationId "com.***"
        minSdkVersion 11
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    dexOptions {
        javaMaxHeapSize "4g"
        incremental true
        preDexLibraries = false
    }
    buildTypes {

        release {
            multiDexEnabled true

            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable false
        }
        debug {
            multiDexEnabled true
            debuggable true
            minifyEnabled false
        }
    }
    productFlavors {
    }

}

dependencies {
    compile 'com.clevertap.android:clevertap-android-sdk:2.0.5'
    compile 'com.google.android.gms:play-services-gcm:6.5.87'
    compile 'com.google.android.gms:play-services-analytics:6.5.87'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:23.4.0'
    compile project(':httpclient-4.3.6')
    compile project(':httpcore-4.3.3')
    compile project(':httpmime-4.3.6')
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.0@aar') {
        transitive = true;
    }
}

编译时错误

Information:Gradle tasks [:speakup:assembleDebug]
:speakup:preBuild UP-TO-DATE
:speakup:preDebugBuild UP-TO-DATE
:speakup:checkDebugManifest
:speakup:preReleaseBuild UP-TO-DATE
:speakup:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:speakup:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:speakup:prepareComAndroidSupportDesign2340Library UP-TO-DATE
:speakup:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:speakup:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:speakup:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:speakup:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:speakup:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:speakup:prepareComClevertapAndroidClevertapAndroidSdk205Library UP-TO-DATE
:speakup:prepareComCrashlyticsSdkAndroidAnswers138Library UP-TO-DATE
:speakup:prepareComCrashlyticsSdkAndroidBeta120Library UP-TO-DATE
:speakup:prepareComCrashlyticsSdkAndroidCrashlytics260Library UP-TO-DATE
:speakup:prepareComCrashlyticsSdkAndroidCrashlyticsCore2310Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE
:speakup:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE
:speakup:prepareIoFabricSdkAndroidFabric1312Library UP-TO-DATE
:speakup:prepareDebugDependencies
:speakup:compileDebugAidl UP-TO-DATE
:speakup:compileDebugRenderscript UP-TO-DATE
:speakup:generateDebugBuildConfig UP-TO-DATE
:speakup:mergeDebugShaders UP-TO-DATE
:speakup:compileDebugShaders UP-TO-DATE
:speakup:generateDebugAssets UP-TO-DATE
:speakup:mergeDebugAssets UP-TO-DATE
:speakup:processDebugManifest UP-TO-DATE
:speakup:fabricGenerateResourcesDebug
:speakup:generateDebugResValues UP-TO-DATE
:speakup:generateDebugResources
:speakup:mergeDebugResources
:speakup:processDebugResources
:speakup:generateDebugSources
:speakup:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:speakup:compileDebugJavaWithJavac UP-TO-DATE
:speakup:compileDebugNdk UP-TO-DATE
:speakup:compileDebugSources UP-TO-DATE
:speakup:prePackageMarkerForDebug
:speakup:transformClassesWithJarMergingForDebug UP-TO-DATE
:speakup:collectDebugMultiDexComponents UP-TO-DATE
:speakup:transformClassesWithMultidexlistForDebug
ProGuard, version 5.2.1
Reading program jar [C:\Users\Amol\AndroidStudioProjects\Project22\speakup\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar]
Reading library jar [C:\DriveZzzzzz\Android\Dev_Android_Sdk\android-sdk-windows\build-tools\24.0.0\lib\shrinkedAndroid.jar]
Preparing output jar [C:\Users\Amol\AndroidStudioProjects\Project22\speakup\build\intermediates\multi-dex\debug\componentClasses.jar]
  Copying resources from program jar [C:\Users\Amol\AndroidStudioProjects\Project22\speakup\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar]
:speakup:transformClassesWithMultidexlistForDebug FAILED
Error:Execution failed for task ':speakup:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Java\jdk1.7.0_01\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 21.566 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
4

1 回答 1

0
 1 .Add multidex library in your dependency

依赖{

 compile fileTree(dir: 'libs', include: ['*.jar'])
 compile 'com.android.support:multidex:1.0.1'

}

2. 在您的清单中

android:name="android.support.multidex.MultiDexApplication" or add MultiDex.install(this) in your custom Application's attachBaseContext method or your custom Application extend MultiDexApplication

3 In your gradle add multidexEnabled

defaultConfig { multiDexEnabled true minSdkVersion 15 targetSdkVersion 23 ... }

dexOptions {
    incremental = true;
    preDexLibraries = false
    javaMaxHeapSize = "4g" // if your RAM is 4GB
}
于 2016-07-26T12:08:04.970 回答