Check extracted dex only once per usage
am: fe10f9fd25

Change-Id: I529bc3ae057f9fef4cb7c64c3e490a773e1ec0c2
diff --git a/library/src/android/support/multidex/MultiDex.java b/library/src/android/support/multidex/MultiDex.java
index 142f125..fad50d7 100644
--- a/library/src/android/support/multidex/MultiDex.java
+++ b/library/src/android/support/multidex/MultiDex.java
@@ -156,20 +156,7 @@
 
                 File dexDir = getDexDir(context, applicationInfo);
                 List<File> files = MultiDexExtractor.load(context, applicationInfo, dexDir, false);
-                if (checkValidZipFiles(files)) {
-                    installSecondaryDexes(loader, dexDir, files);
-                } else {
-                    Log.w(TAG, "Files were not valid zip files.  Forcing a reload.");
-                    // Try again, but this time force a reload of the zip file.
-                    files = MultiDexExtractor.load(context, applicationInfo, dexDir, true);
-
-                    if (checkValidZipFiles(files)) {
-                        installSecondaryDexes(loader, dexDir, files);
-                    } else {
-                        // Second time didn't work, give up
-                        throw new RuntimeException("Zip files were not valid.");
-                    }
-                }
+                installSecondaryDexes(loader, dexDir, files);
             }
 
         } catch (Exception e) {
@@ -245,19 +232,6 @@
     }
 
     /**
-     * Returns whether all files in the list are valid zip files.  If {@code files} is empty, then
-     * returns true.
-     */
-    private static boolean checkValidZipFiles(List<File> files) {
-        for (File file : files) {
-            if (!MultiDexExtractor.verifyZipFile(file)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
      * Locates a given field anywhere in the class inheritance hierarchy.
      *
      * @param instance an object to search the field into.
diff --git a/library/src/android/support/multidex/MultiDexExtractor.java b/library/src/android/support/multidex/MultiDexExtractor.java
index 6d09245..998ccec 100644
--- a/library/src/android/support/multidex/MultiDexExtractor.java
+++ b/library/src/android/support/multidex/MultiDexExtractor.java
@@ -374,7 +374,7 @@
     /**
      * Returns whether the file is a valid zip file.
      */
-    static boolean verifyZipFile(File file) {
+    private static boolean verifyZipFile(File file) {
         try {
             ZipFile zipFile = new ZipFile(file);
             try {