3

I am exploring Android app in teamcity.I have already install teamcity plugins in android studio.its working fine.but i want to generate signed apk using teamcity tool. can anyone help me Which build step included to generate signed apk? Thanks in advance.

dipali
  • 10,966
  • 5
  • 25
  • 51

1 Answers1

0

You can add your keystore file to the project and "call" it from the build.gradle file.

Add the Keystore file to:

MyApp/app/keystore.jks

Then use add the following to you build.gradle, this has to go in front of the buildTypes:

signingConfigs {
    release {
        storeFile file("keystore.jks")
        storePassword "password"
        keyAlias "MyKey"
        keyPassword "password"
    }
}

In the buildTypes just refer to the signining config by adding the following line:

signingConfig signingConfigs.release

You should end up with something like this:

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
}

To verify that the apk is signed you can use the following command:

%JDK.Path%/jarsigner -verify MyApp/app/build/outputs/apk/MyApp.apk

The %JDK.Path% to be replaced with your JDK path like this:

C:\Program Files\Java\jdk1.8.0_121\bin

Good luck!

thewikus
  • 445
  • 1
  • 5
  • 16