救命!
当我在手机上安装我的应用程序进行测试时,它显示为一个巨大的大小,11.35 MB.这是一个非常简单的应用程序,允许用户浏览有趣的事实.我能想到的唯一原因是,drawable中有14个JPEG文件作为fun-facts的背景图像.它们的平均大小约为500 KB.
我想调整我的应用程序的大小,以免耗尽用户设备上的宝贵资源.除了摆脱图片,有没有办法优化apk文件的大小?
编辑:图片是我使用Android手机拍摄的照片.
当我运行我的应用程序大小的apk将21 MB.甚至我启用了proguard.我用android studio来运行项目.在项目文件中,src文件夹的大小为8.62 MB,lib文件夹的大小为400 KB.所以我如何减少.apk文件的大小.实际上.apk文件在某些日子之前是8 MB,具有相同的图像,但在paypal集成后,我的应用程序大小将增加到21 MB.构建文件夹的大小为127 MB.
build.gradle(模块应用程序)是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.oi.food"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'AndroidManifest.xml'
} }
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/httpmime-4.1.1.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.paypal.sdk:paypal-android-sdk:2.14.1' }
Run Code Online (Sandbox Code Playgroud)