Skip to content

Instantly share code, notes, and snippets.

Shipping it

Stefan Hoth stefanhoth

Shipping it
View GitHub Profile
View setup-android-sdk.bash
# Needs to be updated when new releases are made
curl --location $SDK_DOWNLOAD_URL | tar -xz -C $SDK_HOME_PATH
# Just install platform-tools, build-tools & Android-19
# Filter names are from `android list sdk -e -a`
stefanhoth / LICENSE
Last active October 24, 2015 17:42
Rock Paper Scissors Lizard Spock - Android VectorDrawable definitions based on
Creative Commons Attribution-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 – Definitions.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licen
stefanhoth / GradleWorkersPleaseStopTakingFocus.gradle
Last active August 29, 2015 14:25 — forked from artem-zinnatullin/GradleWorkersPleaseStopTakingFocus.gradle
Prevent Gradle Workers from taking focus! #DevelopersLikeComfort
View GradleWorkersPleaseStopTakingFocus.gradle
// You can place it in the root build.gradle
allprojects {
tasks.withType(JavaForkOptions) {
// Forked processes like GradleWorkerMain for tests won't steal focus!
jvmArgs '-Djava.awt.headless=true'
stefanhoth / device_provider.gradle
Last active August 29, 2015 14:21
Allow gradle to only use devices that meet your criteria
View device_provider.gradle
android {
deviceProvider new AwesomeDeviceProvider(getAdbExe())
class AwesomeDeviceProvider extends {
AwesomeDeviceProvider(File adbLocation) {
stefanhoth /
Last active August 29, 2015 14:16
How to detect if an app is launched on a potentially rooted phone in an non-invasive way. It could be improved by checking existence of known super user apk in the package manager and certain build tags of the ROM.
package com.yourapp;
public final class RootStatus {
private static RootStatus instance;
private final boolean rooted;
stefanhoth / gist:5d6fa521aad322d15d44
Last active August 29, 2015 14:14 — forked from anonymous/gist:1571520dd1aa934fce28
Simple Factory pattern
View gist:5d6fa521aad322d15d44
// The Factory
public final class VehicleFactory {
// private constructor => can't be instanciated, final can't be extended since the constructor is not reachable for a subclass
private VehicleFactory (){
// no-op
public static Vehicel Vehicle produceVehicle(String name, String manufacturer, int horsepowerInPS){
return new Vehicle(name, manufacturer, horsepowerInPS);
stefanhoth / tools_override.xml
Last active August 29, 2015 14:13
Override a views visibility at design time using the tools namespace. See line 13 how and don't forget to add line 2. See for details.
View tools_override.xml
<LinearLayout xmlns:android=""
stefanhoth / build.gradle
Last active March 3, 2017 12:03
Simple plugin for build.gradle to instruct Jetbrains IDEA-based IDEs (IntelliJ, Android Studio) to download sources of the dependencies. More settings can be found here:
View build.gradle
// your code
apply from: "build-plugins/idea-gradle-sources.gradle"
stefanhoth / jack.bat
Last active August 29, 2015 14:11
Jack & Jill command line helpers. Put them in a directory in your PATH, e.g. <android-sdk>/. Use .bat files for Windows, .sh for Mac/Linux. More info in the documentation:
View jack.bat
@REM Jack is only available from build tools version 21.1.0 and up. Install/Update via SDK Manager
java -jar %ANDROID_HOME%/build-tools/%BUILD_TOOLS_VERSION%/jack.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
stefanhoth / build.gradle
Created June 11, 2014 06:56
AndroidDev / gradle: How to rename your output apk during build time to include details like the version.
View build.gradle
android {
// .. set up build flavors etc here
//instead of "app-release.apk" this method will rewrite the name to
// "MyCoolCompany-MyGreatProduct-v<defaultConfig.versionName>-RELEASE.apk which is much better suited for archiving and overall handling
// To restore the default behavior just delete the whole block below
applicationVariants.all { variant ->
def apk = variant.outputFile;