我生成的签名 apk 大小为 30kB,当我将 play services gcm 添加到 gradle 文件时,apk 大小增加到 800kB。通过缩小资源,apk 大小变为 600kB。
如何进一步减小应用程序大小?
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
-overloadaggressively
-repackageclasses ''
-allowaccessmodification
这些可能会有所帮助。 (特别是3遍)
关于android - 使用 Play 服务 gcm 时如何减小 apk 大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34529504/