gpt4 book ai didi

android 发布 apk 比调试 apk 大

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:48:23 26 4
gpt4 key购买 nike

我正在使用混淆器来减小我的 apk 大小。调试 apk 从 90mb 减少到 55mb,但签名的 apk 是 71mb。这是我的 build.gradle 代码:

apply plugin: 'com.android.application'

android {

signingConfigs {
XXXX {
keyAlias 'xxxx'
keyPassword 'xxxx'
storeFile file('/Users/xxxx.jks')
storePassword 'xxxxxx'
}
}
compileSdkVersion 23
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 14
targetSdkVersion 22
versionCode 61
versionName "4.1.8.1"
multiDexEnabled true
signingConfig signingConfigs.XXXX

ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.XXXX
}
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.XXXX
}
}
productFlavors {
}

dexOptions {
javaMaxHeapSize "4g"
}

packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}

repositories {
mavenLocal()
maven {
name "jcenter"
url "http://jcenter.bintray.com/"
}
}

dependencies {
...
}

enter image description here

enter image description here

最佳答案

进一步解释sosite's answer ,似乎只有比较通过 Run 或 Debug 为特定设备(即使没有启用 Instant Run)构建的 debug apk 而不是通过构建的 debugapk 时才会发生这种情况构建 > 构建 APK(适用于任何支持的设备)。

通过 Build APK 构建的任何变体(甚至 debug 本身)都将包含该变体的所有资源。此外,Run/Debug apk 包含特定于该单个设备的预定义类,而 Build APK 仅包含一些编译器确定安全的通用预定义类所有支持的设备 - 完整的 dexing 只发生在设备本身,当安装 apk 时。

我已经将通过 Debug 生成的 apk 与通过 Build APK 生成的 apk 压缩为同一项目的相同变体和 published the simplified output用于演示 ( also available as html )。

关于android 发布 apk 比调试 apk 大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39636182/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com