GCM时如何减少APK大小

GCM时如何减少APK大小

本文介绍了使用Play Services GCM时如何减少APK大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我生成的签名的apk大小为30kB,当我添加播放服务gcm 以gradle文件时,其apk大小已增加到800kB.通过缩小资源,apk大小变为600kB.

My generated signed apk size is 30kB, when I add play services gcm to gradle file the apk size increased to 800kB. by shrinking resource the apk size become 600kB.

如何进一步减小应用程序大小?

How could I reduce app size further?

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.test.mytest"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
            shrinkResources true
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-gcm:8.1.0'
}

推荐答案

来自 http: //proguard.sourceforge.net/manual/examples.html#application

-超载

-repackageclasses''

-repackageclasses ''

-allowaccess修改

-allowaccessmodification

这些可能会有所帮助. (特别是3个通行证)

these might help. (in particular the 3 passses)

这篇关于使用Play Services GCM时如何减少APK大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 20:52