Skip to content

Instantly share code, notes, and snippets.

@runningcode
runningcode / build.gradle
Created March 22, 2022 15:00
JDKImage miss
normalization {
runtimeClasspath {
metaInf {
ignoreAttribute("Implementation-Version")
ignoreAttribute("Implementation-Vendor")
ignoreAttribute("Created-By")
}
}
}
@runningcode
runningcode / build.gradle
Last active February 25, 2022 14:24
DeepLinkDispatch CommandLineArgumentProvider
class DeepLinkDispatchDirProvider implements CommandLineArgumentProvider{
@OutputDirectory
File outputDir
DeepLinkDispatchDirProvider(File outputDir) {
this.outputDir = outputDir
}
@Override
@runningcode
runningcode / directorystructure.build.gradle
Last active February 16, 2022 12:04
Print build directory structure
tasks.withType(Jar).configureEach { task ->
doFirst {
buildScan.value("Jar doFirst ${task.name}", printDirectoryTree(buildDir.path))
}
}
/**
* Pretty print the directory tree and its file names.
*
* @param path
@runningcode
runningcode / build.gradle
Created October 9, 2020 08:45
Resolve all dependencies
task resolveAllDependencies {
dependsOn {
def resolvableConfigurations = project.configurations.grep { it.canBeResolved }
resolvableConfigurations.collect { config ->
config.getIncoming().artifactView({ view ->
view.componentFilter({ it instanceof ModuleComponentIdentifier })
}).getFiles();
}
}
}
@runningcode
runningcode / build.gradle
Last active September 28, 2020 16:22
Workaround for Google Play Services Gradle Plugin Memory Leak
gradle.buildFinished {
// Null out this static field which continues to grow with every build.
// Remove when this is released: https://github.com/google/play-services-plugins/pull/155
// https://github.com/google/play-services-plugins/issues/156
com.google.android.gms.StrictVersionMatcherPlugin.globalDependencies = null
}
@runningcode
runningcode / build.gradle
Created July 29, 2020 17:41
Print out Android Studio Injected properties
project.properties.forEach { key, value ->
if (key.startsWith('android.injected')) {
println("$key:$value")
}
}
@runningcode
runningcode / build.gradle
Last active January 27, 2021 10:07
Tasks not to cache on CI
def tasksToNotCacheOnCi = [
"package.*Resources.*",
"merge.*Resources.*",
"merge.*Assets.*",
"process.*Resources.*",
"package.*Assets.*",
"merge.*NativeLibs",
"generate.*BuildConfig",
"generate.*ResValues",
"generate.*CompatibleScreenManifests",
@runningcode
runningcode / SkippedFramesCounter.java
Last active March 18, 2016 17:08
Skipped Frames Counter
import android.view.Choreographer;
import timber.log.Timber;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
/**
* This class is based on a talk by Jason Sendros (Facebook) at Droidcon NYC 2015.
* This class keeps track of the number of skipped frames and the number of skipped frames
* caused by GC events.