I'm using project structure like this:
root
|--build.gradle
|--settings.gradle
|
|--child1
| |--build.gradle
|
|--child2
|--build.gradle
In both child projects build.gradle contains the following:
apply plugin: 'android'
...
android {
...
signingConfigs {
release {
storeFile file("release.keystore")
storePassword "pass"
keyAlias "alias"
keyPassword "pass"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
...
}
How can I move signingConfigs part to the root project to reduce code duplication?
So far the only solutions I could find is either putting the signingConfigs in the buildTypes so all Beta variants would have the same signingConfigs: buildTypes { beta { signingConfigs.beta } release { signingConfigs.release } } Alternatively, using the flavors, in which case all free variants would have the same signingConfigs:
and now the signingconfigs work with the run button on the toolbar. For a default keystore the local.properties looks like In your Jenkins build script, you need to create a symbolic link from local.properties to where the properties file is on your build server.
You can use MSBuild to build multiple projects faster by running them in parallel. To run builds in parallel, you use the following settings on a multi-core or multiple processor computer:
Setting the signingConfig on the mergedFlavor does not actually sign the assembled apps. In my case, everything works fine and I sign up Google Market apps without any problems. This seems to be working fine for me as well.
I have try this code and it works. Be aware do not use signingConfigs in android-library project.
subprojects {
afterEvaluate {
def isAndroidProject = project.plugins.hasPlugin('android')
def isLibraryProject = project.plugins.hasPlugin('android-library')
if (isAndroidProject || isLibraryProject) {
android {
compileSdkVersion 19
buildToolsVersion 19.0.1
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
if (isAndroidProject) {
signingConfigs {
release {
storeFile file("${rootDir}/platform.keystore")
storePassword "android"
keyAlias "platform"
keyPassword "android"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), "${project.projectDir}/proguard-project.txt"
}
}
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def buildType = variant.buildType.name
if (buildType.equals('release')) {
def fileName = "${project.name}.apk";
output.outputFile = new File(output.outputFile.parent, fileName)
output.assemble.doLast {
copy {
from output.outputFile.getAbsolutePath()
into "../apks/"
}
}
}
}
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With