Skip to content

Instantly share code, notes, and snippets.

@f3401pal
f3401pal / app\build.gradle.kts
Last active April 2, 2025 04:58
Multi-module Android project with Kotlin DSL for Gradle
plugins {
`android-base-app`
`android-base`
id("io.fabric")
}
android {
defaultConfig {
versionCode = 20
versionName = "1.6.3"
@zhangn1985
zhangn1985 / build_criu.sh
Last active April 11, 2021 08:08
criu Android NDK build script
#!/bin/sh
export NDK=$(pwd)/android-ndk
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64/
export PATH=$TOOLCHAIN/bin:$PATH
export SYSROOT=$TOOLCHAIN/sysroot
export CC="x86_64-linux-android28-clang --sysroot $SYSROOT"
export CXX="x86_64-linux-android28-clang++ --sysroot $SYSROOT"
@paolop
paolop / LogExtensions.kt
Last active November 20, 2023 09:55
Android logging utilities.
import android.util.Log
import com.paolo
import kotlin.reflect.KClass
/* Convenient wrappers over Android Log.* static methods */
/** Wrapper over [Log.i] */
inline fun <reified T> T.logi(message: String, onlyInDebugMode: Boolean = true, enclosingClass: KClass<*>? = null) =
@radium226
radium226 / emulator-with-fake-webcam.sh
Created April 26, 2017 12:27
Run an Android emulator with a fake webcam
#!/bin/bash
export REAL_DEVICE="/dev/video0"
export FAKE_DEVICE="/dev/video1"
export DURATION="5"
export SIZE="320x240"
export AVD="Nexus_5X_API_25"
@sabpprook
sabpprook / gist:3a05cdaa0a2bab91de35a9de5d3bd2cf
Created September 19, 2016 23:27
Android ID change via ADB shell
adb shell content query --uri content://settings/secure --where "name=\'android_id\'"
adb shell content delete --uri content://settings/secure --where "name=\'android_id\'"
adb shell content insert --uri content://settings/secure --bind name:s:android_id --bind value:s:7373de1e9e9670c2
@TWiStErRob
TWiStErRob / OkHttpProgressGlideModule.java
Last active July 1, 2024 09:15
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}