Skip to content

Instantly share code, notes, and snippets.

@runningcode
runningcode / build.gradle
Created Oct 9, 2020
Resolve all dependencies
View build.gradle
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 Sep 28, 2020
Workaround for Google Play Services Gradle Plugin Memory Leak
View build.gradle
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 Jul 29, 2020
Print out Android Studio Injected properties
View build.gradle
project.properties.forEach { key, value ->
if (key.startsWith('android.injected')) {
println("$key:$value")
}
}
@runningcode
runningcode / build.gradle
Last active Jan 27, 2021
Tasks not to cache on CI
View build.gradle
def tasksToNotCacheOnCi = [
"package.*Resources.*",
"merge.*Resources.*",
"merge.*Assets.*",
"process.*Resources.*",
"package.*Assets.*",
"merge.*NativeLibs",
"generate.*BuildConfig",
"generate.*ResValues",
"generate.*CompatibleScreenManifests",
View SkippedFramesCounter.java
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.