Add mockito-target-minus-junit4.

As the name suggests, this is a version of mockito-target that contains
no junit classes. Most unit tests are run with android.test.runner in their
classpath, and that library pulls in its own copy of junit that might be a
different version from the one being pulled in here.

This is pretty brittle, but we've painted ourselves into a corner by
making junit a public API anyway.

bug: 26458139

Change-Id: I5d5f7c53364264b88cdab6292eab38c147a0c737
diff --git a/Android.mk b/Android.mk
index 9f9ff11..4ddaa58 100644
--- a/Android.mk
+++ b/Android.mk
@@ -76,8 +76,18 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := mockito-target
-LOCAL_STATIC_JAVA_LIBRARIES := mockito-api dexmaker dexmaker-mockmaker \
-    objenesis-target junit4-target
+LOCAL_STATIC_JAVA_LIBRARIES := mockito-target-minus-junit4 junit4-target
+LOCAL_SDK_VERSION := 10
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+# A mockito target that doesn't pull in junit4-target. This is used to work around
+# issues caused by multiple copies of junit4 in the classpath, usually when a test
+# using mockito is run using android.test.runner.
+include $(CLEAR_VARS)
+LOCAL_MODULE := mockito-target-minus-junit4
+LOCAL_STATIC_JAVA_LIBRARIES := mockito-api dexmaker dexmaker-mockmaker objenesis-target
+LOCAL_JAVA_LIBRARIES := junit4-target
 LOCAL_SDK_VERSION := 10
 LOCAL_MODULE_TAGS := optional
 include $(BUILD_STATIC_JAVA_LIBRARY)