<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Benoît &quot;BoD&quot; Lubek on Medium]]></title>
        <description><![CDATA[Stories by Benoît &quot;BoD&quot; Lubek on Medium]]></description>
        <link>https://medium.com/@bod?source=rss-adec517936f4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ogH-i6u7sVyWz3HSUd62ag.png</url>
            <title>Stories by Benoît &amp;quot;BoD&amp;quot; Lubek on Medium</title>
            <link>https://medium.com/@bod?source=rss-adec517936f4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 10:06:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bod/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How slow are your Android builds?]]></title>
            <link>https://medium.com/qonto-way/how-slow-are-your-android-builds-4b9e2dec092d?source=rss-adec517936f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b9e2dec092d</guid>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Benoît "BoD" Lubek]]></dc:creator>
            <pubDate>Mon, 29 Mar 2021 07:43:41 GMT</pubDate>
            <atom:updated>2021-03-29T09:23:06.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hgMBWMKl4C8v1_aSMi_9Rg.png" /></figure><blockquote><em>💡 </em>This is a follow-up to <a href="https://medium.com/qonto-way/mobile-developers-are-you-performing-4f28f927b771">this article</a> about the setup of a visual board for the mobile team at Qonto. We recommend you have a look if you haven’t yet!</blockquote><h3>Growing pains</h3><p>Ask any Android developer, and they will attest that building is slow. Qonto is no exception. A few months ago, we started noticing our builds were <em>probably</em> too slow. A few developers expressed their frustration, complaining that they were tired of waiting all the time, and asking for new machines. But some of us also thought it was not that bad.</p><p>“It depends” then. But what can we do about it? And should we even try to do something about it? How slow are our Android builds, exactly 🤔? Well, there’s only one way to know: <strong>measure</strong>.</p><p>In addition to giving the answer, this information could prove helpful in more that one way:</p><ul><li>keeping track of the trend over time: is it generally getting worse or better?</li><li>detecting obvious anomalies (e.g. a spike after some change, or one developer having significantly worse or better times than the rest)</li><li>helping decision-makers determine whether to invest in more powerful hardware 😁</li><li>trying alternative solutions (remote compilation?) and <strong>comparing</strong></li></ul><p>We decided to go ahead with this idea, but how did we implement it? Keep on reading to find out.</p><h3>Dive in</h3><p>Before starting this process, we decided to write down a brief summary of our requirements:</p><ul><li>the data would have to end up on our (Metabased based) team board</li><li>it should be granular enough to know which specific Gradle tasks are taking the most time</li><li>it should include the machine’s specs and developer’s id</li><li>collecting data shouldn’t impact the build time</li><li>bonus points if this work can also be used by the iOS team</li></ul><h4>Measuring</h4><p>Some research revealed that an existing Gradle plugin would likely fit our needs quite well: <a href="https://github.com/passy/build-time-tracker-plugin">build-time-tracker-plugin</a>:</p><ul><li>easy to integrate</li><li>gathers extensive data (for each build we get, for each task, the time it took, as well as a few more info like the machine specs)</li><li>produces the results in an easily exploitable format (either CSV or JSON)</li><li>open-source of course, so it’s possible to tweak it if needed. The code (in Groovy) looks rather simple (~600 LOC).</li></ul><p>However:</p><ul><li>it is not currently easily extensible (no plugin mechanism, e.g., to create a custom reporter) — unless we decide to fork the project.</li></ul><p>With that in mind, the plan became clear: we would simply have to integrate this plugin “as is” (collect data in the CSV format), and implement a small layer on top to push the data to a server, where it could then be analyzed and visualized.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Npv1a647DvGDRVGQxmHhEw.png" /></figure><h4>Infrastructure</h4><p>We knew from the start we wanted to integrate and visualize the data into our team board (based on <a href="https://www.metabase.com/">Metabase</a>), so we needed a way for the developers’ machines to somehow export it. Again, there are several ways to do this but we opted for an intermediate service based on PostgreSQL and PostgREST: no in-house development needed, plus this could also be re-used for other needs — for instance, to collect iOS build times (with a slightly different data schema), which was one of the initial goals.</p><h4>Pushing the data</h4><p>Finally, we needed a way to push the CSV data collected on developers’ machines to the service. We decided to implement a simple command-line tool in Kotlin — the language the team is most used to — and to invoke this tool at the end of each build (using the <a href="https://docs.gradle.org/current/javadoc/org/gradle/api/invocation/Gradle.html#buildFinished-groovy.lang.Closure-">gradle.buildFinished hook</a>).</p><p>There’s one little trick: as making a network call to upload the data can be quite time-consuming (and we’re actually trying to save seconds here!) we decided we would do this at most once a day. To that effect, the tool simply saves the date of the latest successful upload and uses that to decide if the upload should occur for any given build.</p><p>Lastly, we made sure the local CSV got purged after a successful upload (as it can grow big, fast).</p><p>This ended up being a fairly simple project (~200 LOC) with these dependencies:</p><ul><li><a href="https://github.com/Kotlin/kotlinx-cli">kotlinx-cli</a> to parse command-line arguments</li><li><a href="https://commons.apache.org/proper/commons-csv/">Apache Commons CSV</a> to read and parse the CSV file</li><li><a href="https://square.github.io/retrofit/">Retrofit</a> and <a href="https://github.com/google/gson">Gson</a> to make the API call</li></ul><p>And that’s it 😁!</p><h3>The result</h3><p>Here are a few examples of how we can visualize the data on Metabase:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPgiBwDOV9D0eQw4wf340Q.png" /><figcaption>Cumulative build time (minutes) per day, for one developer</figcaption></figure><p>This graph with the cumulative times can give an insight on how much time a developer typically wastes every day, waiting for builds to finish (we could also look at the per week and per month values, etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGr6HvF548cylLcom38lCw.png" /><figcaption>Average build time (minutes) vs number of builds per day, for the whole team</figcaption></figure><p>This graph with average times per day is perfect to reveal a tendency or trend over time (is it getting better or worse?), or spot a specific change that impacted the performance. We also display the number of builds on the graph to reason about the meaningfulness of the average.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*POcPhyQNWbcOZD6eEG85-w.png" /><figcaption>Average build time (minutes) in the last 30 days, per developer</figcaption></figure><p>This one is a break down per developer (based on the last 30 days), with the goal of allowing us to detect a teammate facing an abnormal spike.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1D8ZVEC_P0spDrvHIRR1Jw.png" /><figcaption>Average build time (milliseconds) per machine specs</figcaption></figure><p>Here it’s interesting to notice the average build time can <strong>double</strong> depending on the specs! (Caveat: here all the builds are included, including the ones that resulted in a fail).</p><p>We also learned an interesting tidbit about developers’ habits: on average, we build about 23 times a day! Now we know.</p><h3>What’s next?</h3><p>And there we go, we achieved our goals:</p><ul><li>our team board now includes a few graphs representing Android build times</li><li>we’re able to monitor the values and trends and detect potential problems</li><li>the data includes enough information to allow more in-depth analysis (machine spec, developer’s id, task name)</li><li>the infrastructure put in place can be used for other needs</li><li>and this without impacting the build time</li></ul><p>Now, we’ve been collecting data and monitoring for about 2 months, and we’re still pretty new at this. Here are a few ideas of things to explore:</p><ul><li>implement the same for the iOS team (already in progress!)</li><li>exclude failed builds from average durations calculations (as they are a lot shorter which skews the data)</li><li>more graphs, and maybe alerts — for instance, if average durations are above a threshold</li><li>explore remote compilation solutions and see if it helps</li></ul><h3>About Qonto</h3><p><a href="https://qonto.com/en">Qonto</a> is a neobank for SMEs and freelancers founded in 2016 by Steve Anavi and Alexandre Prot. Since the launch in July 2017, Qonto has made business banking easy for more than 150,000 companies. Thanks to Qonto, business owners save time (streamlined account opening before a day-to-day user experience with unlimited history, accounting exports, expense management feature), have more control while giving their teams autonomy (real-time notifications, user right management system) and have improved visibility on cash-flows (smart dashboards, transactions auto-tagging, and cash-flow monitoring). They also enjoy stellar customer support, at a fair and transparent price.</p><p>Interested in joining a challenging and game changer company? Consult our <a href="https://qonto.com/en/careers">job offers</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b9e2dec092d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/qonto-way/how-slow-are-your-android-builds-4b9e2dec092d">How slow are your Android builds?</a> was originally published in <a href="https://medium.com/qonto-way">The Qonto Way</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cache your Android SDK with Travis]]></title>
            <link>https://medium.com/@bod/cache-your-android-sdk-with-travis-c816b9264708?source=rss-adec517936f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c816b9264708</guid>
            <category><![CDATA[travis-ci]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Benoît "BoD" Lubek]]></dc:creator>
            <pubDate>Mon, 06 Mar 2017 00:18:01 GMT</pubDate>
            <atom:updated>2020-06-28T18:00:21.267Z</atom:updated>
            <content:encoded><![CDATA[<h4>Enjoy faster builds by avoiding unnecessary downloads.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*DOfrOJ1xthI80CjJY8nKHA.png" /></figure><p><em>Last updated: Jun 28, 2020</em></p><p>If you use Travis to build your Android app and followed <a href="https://docs.travis-ci.com/user/languages/android/">the official guide</a>, you may have noticed that your builds are… well, slow 🙂 For instance, a very small app I’m working on would take about 10 minutes to build (going up to 15 minutes on some occasions.)</p><p>Apart from the “normal” slowness of Gradle builds, one reason is that, by default, Travis will download and install the Android SDK and its components - for<strong> Every. Single. Build</strong>. Yes you read that correctly. Also remember that by default a build is executed for every commit 😱 I mean, never mind the slowness, but what a waste of energy and bandwidth!</p><p>The solution of course is to include the Android SDK in the cache so, except for the first time, nothing will be downloaded/installed.</p><p>After doing that on my little app, builds now take about 2 minutes (most of which are spent on the actual Gradle execution.)</p><p>Now how do you do this?</p><h3>Don’t use the default Travis Android SDK</h3><p>It’s probably possible to cache the Android SDK included with the Travis Android images, but it’s better to do it manually because:</p><ul><li>you control where to install it</li><li>the latest version available with Travis is quite old.</li></ul><p>So we’re not going to use Travis’ Android sdk (language: java) and we’re going to download the latest Android command line tools, unzip them, and then install components using the <a href="https://developer.android.com/studio/command-line/sdkmanager.html">sdkmanager</a> tool:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1ba350ae660e1279bf6e83a6c80a7f2/href">https://medium.com/media/b1ba350ae660e1279bf6e83a6c80a7f2/href</a></iframe><p>As you can see (line 4), we check if the command line tools zip already exists before downloading it — since the destination path is included in the cache, this ensures it will be downloaded only the first time.</p><p>We then unzip it (line 5) with the -n flag to skip files that are already present, and with -qq to not pollute the logs.</p><p>Then we install/update components — this will not do anything if they are already up to date. Note: the echo y | part is there to “accept” the licenses. We also pipe that to /dev/null to not pollute the logs with the licenses.</p><h3>Cache the SDK</h3><p>Now you simply need to include the SDK path in the cache section of the build file (also include the path where the zip is downloaded):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9863351f2631c79a37e393ff72d000b/href">https://medium.com/media/a9863351f2631c79a37e393ff72d000b/href</a></iframe><p>Last but not least, in order for your build to use this SDK, you need to set the ANDROID_HOME environment variable:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e9424d46af8fd62c0753052f21ad7d7/href">https://medium.com/media/5e9424d46af8fd62c0753052f21ad7d7/href</a></iframe><p>And that’s it! <strong>Enjoy faster builds</strong> 👍</p><p>Here’s the complete .travis.yml file for reference:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2fe4b961c4d26d284122c34b88f6cd4/href">https://medium.com/media/d2fe4b961c4d26d284122c34b88f6cd4/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c816b9264708" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>