Issue
Due to an issue building my application in release mode with the gradle plugin 1.3.0, I have switched to 1.4.0 (beta 2), which fixes said build issue.
However, whereas some flavors build perfectly, others have their build aborted with the following error message:
Cannot filter assets for multiple densities using SDK build tools 21 or later. Consider using apk splits instead.
I haven't found any reference to the sentence above, what should I do with the resources of these flavors, or even why this error only appears in a couple of flavors and not in all of them.
Edit: build.gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
}
}
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.appname"
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName '0.0.1'
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled true
zipAlignEnabled true
signingConfig signingConfigs.config
}
debug {
applicationIdSuffix 'debug'
versionNameSuffix '_debug'
}
}
flavorDimensions "googleplay"
productFlavors {
noplay {
dimension "googleplay"
versionCode Integer.parseInt(defaultConfig.versionCode + "0")
buildConfigField "boolean", "HAS_GOOGLE_PLAY", "false"
resConfigs "ldpi", "mdpi"
// so far we are using the noplay flavor only for old devices, which do not have hidpi
}
play {
dimension "googleplay"
versionCode Integer.parseInt(defaultConfig.versionCode + "1")
buildConfigField "boolean", "HAS_GOOGLE_PLAY", "true"
minSdkVersion 9
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// Google Play services (analytics)
playCompile 'com.google.android.gms:play-services-analytics:8.1.0'
// ActionBar and support libraries
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
}
Solution
resConfigs is replaced by APK splits for densities and architectures. Note the following sentence:
When using build tools older than 21 you could also add resConfigs "nodpi", "hdpi" to also limit the density folders that are packaged. Instead, use apk splits to provide different apks to devices with different densities.
There is a bug report for this issue.
The offending resConfigs have to be removed, and apk splits can be used in their instead.
Alternatively, switching to build-tool 20.0.0 seems work around this problem.
Answered By - Hexise
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.