我的3MB应用程序(使用proguard减小尺寸)在Play商店
但安装后,它变为22MB。
我想把手机的22MB大小减少到8到10MB
任何人都知道任何工具可以告诉谁在安装后占用的尺寸最大?这样我就可以减少应用程序的这一部分或从应用程序中删除这些功能。
关于@Ankita请求
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
signingConfigs {
release_config {
keyAlias 'XXXX'
keyPassword 'XXXX'
storeFile file('F:\\key.jks')
storePassword 'XXXX'
}
}
compileSdkVersion 25
buildToolsVersion '26'
defaultConfig {
applicationId "in.workindia.nileshdungarwal.workindiaandroid"
minSdkVersion 15
targetSdkVersion 22
versionCode 138
versionName "3.9.3.1"
resConfigs "en", "hi"
//testApplicationId 'in.workindia.nileshdungarwal.workindiaandroid.test'
}
buildTypes {
release {
//versionNameSuffix "-DEV-TEST"
//applicationIdSuffix ".test"
debuggable false
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release_config
}
debug {
useProguard false
versionNameSuffix "-DEBUG"
applicationIdSuffix ".debug"
/*Disable the fabric for debug version and do not update*/
ext.alwaysUpdateBuildId = false
}
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode true
}
buildTypes.debug {
it.buildConfigField 'String', 'BASE_URLS', DEBUG_URLS
it.buildConfigField 'Boolean', 'BRANCH_IO_MODE_IS_LIVE', BRANCH_IO_MODE_DEBUG
it.buildConfigField 'String', 'OFFICE_CONTACT_NO', OFFICE_CONTACT_NO
it.buildConfigField 'String', 'CLIENT_ID', SERVER_DEBUG_CLIENT_ID
it.buildConfigField 'String', 'SECRET_KEYS', SERVER_DEBUG_CLIENT_SECRET
it.buildConfigField 'String', 'GOOGLE_GEOLOCATION_API_KEY', GOOGLE_DEBUG_GEOLOCATION_API_KEY
it.buildConfigField 'String', 'TAG_MANAGER_CONTANER_ID', DEBUG_TAG_MANAGER_CONTANER_ID
it.buildConfigField 'String', 'MQTT_BROKER_USERNAME', MQTT_BROKER_USERNAME
it.buildConfigField 'String', 'MQTT_BROKER_PASSWORD', MQTT_BROKER_PASSWORD
it.buildConfigField 'String', 'POLE_API_KEY', POLE_API_KEY
}
buildTypes.release {
it.buildConfigField 'String', 'BASE_URLS', BASE_URLS
it.buildConfigField 'Boolean', 'BRANCH_IO_MODE_IS_LIVE', BRANCH_IO_MODE_LIVE
it.buildConfigField 'String', 'OFFICE_CONTACT_NO', OFFICE_CONTACT_NO
it.buildConfigField 'String', 'CLIENT_ID', SERVER_RELEASE_CLIENT_ID
it.buildConfigField 'String', 'SECRET_KEYS', SERVER_RELEASE_CLIENT_SECRET
it.buildConfigField 'String', 'GOOGLE_GEOLOCATION_API_KEY', GOOGLE_RELEASE_GEOLOCATION_API_KEY
it.buildConfigField 'String', 'TAG_MANAGER_CONTANER_ID', RELEASE_TAG_MANAGER_CONTANER_ID
it.buildConfigField 'String', 'MQTT_BROKER_USERNAME', MQTT_BROKER_USERNAME
it.buildConfigField 'String', 'MQTT_BROKER_PASSWORD', MQTT_BROKER_PASSWORD
it.buildConfigField 'String', 'POLE_API_KEY', POLE_API_KEY
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
afterEvaluate {
// processDebugGoogleServices.dependsOn switchToDebug
processReleaseGoogleServices.dependsOn switchToRelease
}
task printDependencies << {
configurations.compile.each { println it.name }
}
task switchToDebug(type: Copy) {
description = 'Switches to DEBUG google-services.json'
from "src/debug_work"
include "google-services.json"
into "."
}
task switchToRelease(type: Copy) {
description = 'Switches to RELEASE google-services.json'
from "src/release_work"
include "google-services.json"
into "."
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.1.1') {
exclude module: 'support-v4'
transitive = true
}
compile files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
compile 'me.pushy:sdk:1.0.26'
compile 'io.branch.sdk.android:library:2.+'
compile 'com.facebook.android:facebook-android-sdk:4.19.0'
compile 'com.google.android.gms:play-services-location:9.6.1'
compile 'com.google.android.gms:play-services-analytics:9.6.1'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.3'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
compile 'com.mixpanel.android:mixpanel-android:5.+'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-jackson:2.1.0'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.edmodo:rangebar:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:1)
我个人会说使用ProGuard
ProGuard将删除未使用的Java代码。它有很大帮助 减少代码脚印.ProGuard是Java字节码最流行的优化器。它使您的Java和Android应用程序缩小了90%,速度提高了20%。 ProGuard还通过混淆类,字段和方法的名称来提供对逆向工程的最小保护。
阅读有关Reduce APK Size
的官方指南。