I have a project with following structure:
Root
\__main_project
|
\__modules
\__
| library1
|
\__
library2
I have following config in my gradle:
android {
compileSdkVersion 19
buildToolsVersion '19.0.0'
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
}
signingConfigs {
release {
storeFile file('/home/home/.signing/test.keystore')
storePassword 'testtest'
keyAlias 'testtest'
keyPassword 'testtest'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
to build my project I run following command:
./gradlew :main_project:assembleRelease
but it only produces main_project-release-unsigned.apk
So my question why it produces unsigned apk when I specified all required configuration. Thank you.
The "official" way to configure the build.gradle file as recommended by Google is explained here.
Basically, you add a "signinConfig", in where you specify the location an password of the keystore. Then, in the release build type, refer to that signing configuration.
...
android {
...
defaultConfig { ... }
signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "password"
keyAlias "MyReleaseKey"
keyPassword "password"
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
}
...
Then build the app with the "assembleRelease" task.
Try ./gradlew assembleRelease
.
Also you'll probably want to augment the buildTypes release section
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
zipAlign true
}
}
Also see task askForPasswords
on How to create a release signed apk file using Gradle? for how to prompt for the passwords so they aren't stored in this file.
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