Skip to content

Instantly share code, notes, and snippets.

package com.example;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.exceptions.CompositeException;
import io.reactivex.exceptions.Exceptions;
@tir38
tir38 / Example.java
Last active December 14, 2018 19:26
Using delay does not work like I think it does
package com.example;
import org.junit.Test;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.observers.TestObserver;
import io.reactivex.schedulers.Schedulers;
@tir38
tir38 / gist:87b73913233d8f1fb448375d01c91746
Created February 20, 2019 21:02
403 when running flank/fladle via bitrise
> Task :app:assembleDebugAndroidTest
> Task :app:assembleAndroidTest
Download https://github.com/TestArmada/flank/releases/download/v4.2.0/flank.jar
> Task :app:downloadFlank
> Task :app:writeConfigProps
> Task :app:execFlank FAILED
Exception in thread "main" picocli.CommandLine$ExecutionException: Error while running command (ftl.cli.firebase.test.android.AndroidRunCommand@71454b9d): com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
@tir38
tir38 / androidx_test_switching.sh
Created March 29, 2019 22:09
Switching back and forth between Android and AndroidX Test Orchestrator? You'll want to remove old test packages in between.
#!/bin/bash
# Uninstall androidx things
adb uninstall androidx.test.orchestrator
adb uninstall androidx.test.services
# uninstall old android things
adb uninstall android.support.test.services
adb uninstall android.support.test.orchestrator
@tir38
tir38 / runSubsetOfInstrumentationTests.sh
Last active February 5, 2020 23:35
Android: Run instrumentation tests on a single class or single method
#!/bin/bash
if [ -z "$1" ]; then
echo "Must specify module (e.g. app)"
exit 1
fi
if [ -z "$2" ]; then
echo "Must specify build type, starting w/ capital letter (e.g. Debug, DebugFree, ReleasePaid)"
exit 1
@tir38
tir38 / MyPlugin.kt
Last active May 11, 2019 07:36
Creating plugin (located in buildSrc/src/main/kotlin/com/example)
package com.example
import org.gradle.api.Plugin
import org.gradle.api.Project
// :eyes: why is A/S saying 'android' is unresolved reference??
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.LibraryPlugin
class MyPlugin : Plugin<Project> {
@tir38
tir38 / GattDebugger.java
Last active May 16, 2019 21:12
We were badly using reflection to spy on android.bluetooth.BluetoothGatt and see while it would fail to write. Don't do this. Instead vote to have methods added/updated to use public API https://issuetracker.google.com/issues/132907122
package com.example
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
import java.lang.reflect.Field;
#!/usr/bin/env bash
echo "restarting with fresh gradle daemon..."
./gradlew --stop
./gradlew clean
./gradlew --profile --offline --rerun-tasks app:assembleDebug
# Change "--profile --offline" to --scan to use Gradle's scan tool https://guides.gradle.org/creating-build-scans/
# Any build errors while profiling? remove --offline, try again, then re-add --offline
... user triggered event to start download
499 14371-14371/com.example D/MainActivity: About to nav to on-demand feature
507 14371-14371/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallListenerRegistry : registerListener
524 14371-14371/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallService : startInstall([ondemandfeature],[])
527 14371-14683/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallService : Initiate binding to the service.
540 14371-14371/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.splitinstallservice.SplitInstallService})
541 14371-14683/com.example I/PlayCore: UID: [10423] PID: [14371] SplitInstallService : linkToDeath
544 22063-22075/? I/Finsky: [163] uxv.a(48): Start install for package: com.example
567 22063-14685/? I/Finsky: [481] dwq.<init>(25): com.example is installed but certifica
Task :app:execFlank
AndroidArgs
gcloud:
results-bucket: test-lab-xxx
results-dir: null
record-video: false
timeout: 30m
async: false
results-history-name: null
# Android gcloud