This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add helper tasks for uninstalling the apk from devices/emulators | |
android.applicationVariants.all { variant -> | |
tasks.create(name: "uninstall${variant.name.capitalize()}Apk", type: Exec, group: "uninstall") { | |
ignoreExitValue = true | |
commandLine android.getAdbExe(), 'uninstall', variant.applicationId | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just add these to the root build.gradle of any project where | |
// you just want everything to be Java 8 by default | |
subprojects { | |
project.plugins.whenPluginAdded { plugin -> | |
if ("com.android.build.gradle.AppPlugin" == plugin.class.name | |
|| "com.android.build.gradle.LibraryPlugin" == plugin.class.name) { | |
project.android.compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_8 | |
targetCompatibility JavaVersion.VERSION_1_8 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMPUTER_NAME=<shade of green> | |
# Setup hostname | |
# Type the following command to change the primary hostname of your Mac: | |
# This is your fully qualified hostname, for example myMac.domain.com | |
sudo scutil --set HostName $COMPUTER_NAME | |
#Type the following command to change the Bonjour hostname of your Mac: | |
#This is the name usable on the local network, for example myMac.local. | |
sudo scutil --set LocalHostName $COMPUTER_NAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String printKeyHash(Activity context) { | |
PackageInfo packageInfo; | |
String key = null; | |
try { | |
//getting application package name, as defined in manifest | |
String packageName = context.getApplicationContext().getPackageName(); | |
//Retriving package info | |
packageInfo = context.getPackageManager().getPackageInfo(packageName, | |
PackageManager.GET_SIGNATURES); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RxJavaPlugins.setErrorHandler( | |
{ err -> | |
var e = err | |
if (e is UndeliverableException) { | |
e = e.cause | |
} | |
when (e) { | |
is IOException, is SocketException -> return@setErrorHandler // fine, irrelevant network problem or API that throws on cancellation | |
is InterruptedException -> return@setErrorHandler // fine, some blocking code was interrupted by a dispose call | |
is NullPointerException, is IllegalArgumentException -> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
<application> | |
<!-- Set AppTheme.Launcher for launcher activity --> | |
<activity | |
android:name=".MainActivity" | |
android:theme=”@style/AppTheme.Launcher”> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovyx.net.http.ContentType | |
import groovyx.net.http.RESTClient | |
task pushDropbox << { | |
def outName; | |
if (System.getenv("GITLAB_CI")) { | |
outName = "app-debug-${System.getenv("CI_BUILD_REF_NAME")}-SNAPSHOT.apk" | |
} else { | |
outName = "app-debug.apk" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'maven-publish' | |
publishing { | |
repositories { | |
maven { | |
url "http://localhost:8081/repository/maven-releases/" | |
credentials { | |
username "admin" | |
password 'admin123' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SDK=`adb shell getprop ro.build.version.sdk | tr -d '\r'` | |
echo "Device SDK level is: " $SDK | |
if (( "$SDK" >= 23 )) ; then | |
echo "Enabling read and write external storage permissions before running tests on Android 6.0+" | |
adb shell pm grant com.replace.with.your.app.package android.permission.WRITE_EXTERNAL_STORAGE | |
adb shell pm grant com.replace.with.your.app.package android.permission.READ_EXTERNAL_STORAGE | |
fi |
NewerOlder