使用播放服务gcm时如何减小apk大小 [英] How to reduce apk size when using play services gcm

查看:27
本文介绍了使用播放服务gcm时如何减小apk大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我生成的签名 apk 大小为 30kB,当我将 play services 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

-optimizationpasses 3

-optimizationpasses 3

-overloadaggressively

-overloadaggressively

-repackageclasses ''

-repackageclasses ''

-允许访问修改

这些可能会有所帮助.(特别是3遍)

these might help. (in particular the 3 passses)

这篇关于使用播放服务gcm时如何减小apk大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆