我无法弄清楚这一点。自上次发布以来,我的 apk 大小至少增加了 MB。是的,我 添加了一些新代码和几个矢量 Assets ,仅此而已。但是有这个 drawable-xxxhdpi-v4
被添加到我的 apk 并且我的 png 图像在那里重复。
看一看。
有人遇到过这个吗? 我似乎无法弄清楚为什么会这样。它甚至不像这些是新图像。该文件夹中原来为 0 字节的旧文件现在正在占用空间。
Gradle 版本 2.14.1 插件版本 2.2.3
应用构建.gradle:
defaultConfig {
applicationId project.APPLICATION_ID
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
resConfigs "en", "fr"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
lintOptions {
abortOnError false
disable 'MissingTranslation'
}
dataBinding {
enabled = true
}
dexOptions {
preDexLibraries = false
}
// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
noCompress "db"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
def BOOLEAN = "boolean"
def TRUE = "true"
def FALSE = "false"
def LOGGING = "LOGGING"
def STRICT_MODE = "STRICT_MODE"
def DEBUG_MODE = "DEBUG_MODE"
release {
minifyEnabled true
proguardFiles 'proguard-rules.txt', 'proguard-here-sdk.txt'
// Resource shrinking confis
shrinkResources true // remove unused resources
signingConfig signingConfigs.release
debuggable false
buildConfigField BOOLEAN, LOGGING, FALSE
buildConfigField BOOLEAN, STRICT_MODE, FALSE
buildConfigField BOOLEAN, DEBUG_MODE, FALSE
zipAlignEnabled true
applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.mergeAssets.doLast {
delete(fileTree(dir: variant.mergeAssets.outputDir, includes: ['ic_launcher_debug*']))
}
}
}
}
lintOptions {
disable 'InvalidPackage'
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
最佳答案
下面的配置对我有用
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
关于android - Apk 大小增加了 drawable-xxxhdpi-v4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44984690/