Skip to content

Instantly share code, notes, and snippets.

Pat Lackemacher plackemacher

Block or report user

Report or block plackemacher

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
plackemacher /
Created Sep 30, 2015
Robolectric Activity Leak Fix
public void resetWindowManager() {
Class clazz = ReflectionHelpers.loadClass(getClass().getClassLoader(), "android.view.WindowManagerGlobal");
Object instance = ReflectionHelpers.callStaticMethod(clazz, "getInstance");
// We essentially duplicate what's in {@link WindowManagerGlobal#closeAll} with what's below.
// The closeAll method has a bit of a bug where it's iterating through the "roots" but
// bases the number of objects to iterate through by the number of "views." This can result in
// an {@link java.lang.IndexOutOfBoundsException} being thrown.

Keybase proof

I hereby claim:

  • I am plackemacher on github.
  • I am plackemacher ( on keybase.
  • I have a public key whose fingerprint is 8BEB 7688 A0AA D801 5D10 B7FE 6D77 43DD 782C C4CE

To claim this, I am signing this object:

plackemacher / gist:753c72de590d4cf06a5e
Created Jun 27, 2014
TestFairy Gradle exception in Android Studio
View gist:753c72de590d4cf06a5e
Caused by: org.gradle.api.GradleException: Could not locate zipalign, please validate 'buildToolsVersion' settings
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at org.codehaus.groovy.reflection.CachedConstructor.invoke(
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(
You can’t perform that action at this time.