To collect interesting information about your Android APK:
- APK size in bytes
- classes.dex size in bytes
- # methods (useful for monitoring the magical 65k dex limit)
- # classes
Run this script in any folder containing one or more .apk files.
user$ apk-stats.sh
classes methods dex-bytes apk-bytes apk
790 6451 9027848 1080992 SomeApp-production.apk
760 6461 9027860 1081028 SomeApp-debug.apk
700 6661 9027848 1081010 SomeApp-stage.apk
To collect this information from a Team City job it supports TC's system messages which you in turn can use to create nice custom charts for your project/job configuration.
The custom metrics are reported like this:
apk-stats.sh teamcity
Team City system messages enabled!
classes methods dex-bytes apk-bytes apk
790 6451 3027848 5800992 SomeApp-production.apk
##teamcity[buildStatisticValue key='classes-SomeApp-production.apk' value='790']
##teamcity[buildStatisticValue key='methods-SomeApp-production.apk' value='6451']
##teamcity[buildStatisticValue key='dex-size-SomeApp-production.apk' value='3027848']
##teamcity[buildStatisticValue key='apk-size-SomeApp-production.apk' value='5800992']
Team City will automatically pick up these values and you'll see them under the job's Parameters tab and under Reported statistic values. Click on this graph to see the trend.
For a nice graph of these metrics on your project's Statistics tab change your Team City master's .BuildServer/config/projects/:yourProject/pluginData/plugin-settings.xml
to something like this:
<settings>
<custom-graphs>
<graph title=".dex Information">
<properties>
<property name="axis.y.max" value="65536"/>
<property name="axis.y.min" value="0"/>
<property name="height" value="300"/>
</properties>
<valueType key="methods-SomeApp-production.apk" title="Methods (Production)" buildTypeId="project_SomeJob"/>
<valueType key="classes-SomeApp-production.apk" title="Classes (Production)" buildTypeId="project_SomeJob"/>
</graph>
<graph title="APP Size" format="size">
<properties>
<property name="height" value="300"/>
</properties>
<valueType key="dex-size-SomeApp-production.apk" title=".dex (Production)" buildTypeId="project_SomeJob"/>
<valueType key="apk-size-SomeApp-production.apk" title=".apk (Production)" buildTypeId="project_SomeJob"/>
</graph>
</custom-graphs>
</settings>