2
splits {
// Configures multiple APKs based on screen density.
density {
// Configures multiple APKs based on screen density.
enable true
reset()
// Specifies a list of screen densities Gradle should create multiple APKs for.
include 'ldpi', 'mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'
// Specifies a list of compatible screen size settings for the manifest.
//compatibleScreens 'small', 'normal', 'large', 'xlarge'
}
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable false
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
// Specifies that we do want to also generate a universal APK that includes all ABIs.
universalApk true //generate an additional APK that contains all the ABIs
//'armeabi' - Not surported by Realm since v2.0.0
}
}
我試圖拆分我的APK由Desity爲了減少APK大小,使用上面的Gradle它將APK分成密度,但每個APK的可繪製資源是相同的。Android工作室拆分APK在密度
這應該不是xhdpi APK只包含drawable-ldrtl-xhdpi-v17,drawable-xhdpi-v4和mipmap-xhdpi-v4的結果嗎?
你有你所有的繪圖資源作爲xxxhdpi版本?這不是必需的。查看https://developer.android.com/guide/practices/screens_support.html#support中的第一個提示,這可以顯着降低您的APK大小。另外,你可以考慮讓ldpi繪製出來。它們可以從mdpi縮小。 – EarlGrey
不,我們只有xml drawables,我們不能vectorDrawables.useSupportLibrary = true因爲其他依賴關係 –