无法使用Fresco Included生成签名的apk

时间:2017-09-21 09:37:52

标签: android build.gradle fresco

我最近将图像加载库从Glide切换到Fresco,现在我无法生成签名的apk。

我一直收到这个错误;

Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded 

我的Application课程延伸MultidexApplication,我的proguard-fresco.pro中包含build.gradle个文件。

在使用Fresco之前,我的项目每次都成功构建,但现在我无法生成签名的apk。如何缓解这个问题并让我的项目构建?

我的build.gradle文件如下:

buildscript {
    repositories {
        mavenCentral();
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.24.1'
        classpath "com.newrelic.agent.android:agent-gradle-plugin:5.9.0"
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
apply plugin: 'newrelic'
apply plugin: 'me.tatarka.retrolambda'

repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
    maven { url "http://dl.bintray.com/glomadrian/maven" }
}

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"

    defaultConfig {
        applicationId "com.app.android"
        minSdkVersion 19
        targetSdkVersion 26
        renderscriptTargetApi 20
        renderscriptSupportModeEnabled true
        versionCode 79
        versionName "0.9.9"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true

        multiDexKeepProguard file("proguard.multidex.config")
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro'
        }
    }

    retrolambda {
        jvmArgs '-noverify'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    compile 'com.newrelic.agent.android:android-agent:5.9.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:cardview-v7:26.0.1'
    compile 'com.android.support:recyclerview-v7:26.0.1'
    compile 'com.android.support:design:26.0.1'
    compile 'com.google.code.gson:gson:2.8.1'
    compile 'com.google.android.exoplayer:exoplayer-core:r2.5.1'
    compile 'com.google.android.exoplayer:exoplayer-dash:r2.5.1'
    compile 'com.google.android.exoplayer:exoplayer-hls:r2.5.1'
    compile 'com.google.android.exoplayer:exoplayer-ui:r2.5.1'
    compile 'uk.co.chrisjenx:calligraphy:2.1.0'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'com.google.firebase:firebase-core:11.2.0'
    compile 'io.realm:android-adapters:2.1.0'
    compile 'org.parceler:parceler-api:1.1.6'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.andrognito.kerningview:kerningview:1.0.0'
    compile 'com.flurry.android:analytics:6.4.2'
    compile 'com.amazonaws:aws-android-sdk-core:2.6.0'
    compile 'com.amazonaws:aws-android-sdk-pinpoint:2.6.0'
    compile 'com.amazonaws:aws-android-sdk-sns:2.6.0'
    compile 'com.google.android.gms:play-services-gcm:11.2.0'
    compile 'com.wdullaer:materialdatetimepicker:3.1.3'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'org.parceler:parceler:1.1.5'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    compile "com.mixpanel.android:mixpanel-android:5.1.4"
    compile 'com.mani:ThinDownloadManager:1.3.0'
    compile 'com.google.android:flexbox:0.3.0-alpha3'
    compile 'com.airbnb:deeplinkdispatch:3.1.0'
    annotationProcessor 'com.airbnb:deeplinkdispatch-processor:3.1.0'
    compile 'com.facebook.fresco:fresco:1.5.0'
    compile 'jp.wasabeef:fresco-processors:2.1.0'
}

apply plugin: 'com.google.gms.google-services'

0 个答案:

没有答案