private boolean installBundle(ZipFile zipFile, String location, Application application) {

    log.info("processLibsBundle entryName " + location);
    this.bundleDebug.installExternalBundle(location);
    String fileNameFromEntryName = Utils.getFileNameFromEntryName(location);
    String packageNameFromEntryName = Utils.getPackageNameFromEntryName(location);
    if (packageNameFromEntryName == null || packageNameFromEntryName.length() <= 0) {
      return false;
    }
    File archvieFile =
        new File(new File(application.getFilesDir().getParentFile(), "lib"), fileNameFromEntryName);
    if (OpenAtlas.getInstance().getBundle(packageNameFromEntryName) != null) {
      return false;
    }
    try {
      if (archvieFile.exists()) {
        OpenAtlas.getInstance().installBundle(packageNameFromEntryName, archvieFile);
      } else {
        OpenAtlas.getInstance()
            .installBundle(
                packageNameFromEntryName, zipFile.getInputStream(zipFile.getEntry(location)));
      }
      log.info("Succeed to install bundle " + packageNameFromEntryName);
      return true;
    } catch (Throwable e) {
      Log.e("BundlesInstaller", "Could not install bundle.", e);
      return false;
    }
  }
 public static void allFields() throws HackAssertionException {
   ActivityThread_mInstrumentation =
       ActivityThread.field("mInstrumentation").ofType(Instrumentation.class);
   ActivityThread_mAllApplications =
       ActivityThread.field("mAllApplications").ofGenericType(ArrayList.class);
   ActivityThread_mInitialApplication =
       ActivityThread.field("mInitialApplication").ofType(Application.class);
   ActivityThread_mPackages = ActivityThread.field("mPackages").ofGenericType(Map.class);
   ActivityThread_sPackageManager =
       ActivityThread.staticField("sPackageManager").ofType(IPackageManager.getmClass());
   LoadedApk_mApplication = LoadedApk.field("mApplication").ofType(Application.class);
   LoadedApk_mResources = LoadedApk.field("mResources").ofType(Resources.class);
   LoadedApk_mResDir = LoadedApk.field("mResDir").ofType(String.class);
   LoadedApk_mClassLoader = LoadedApk.field("mClassLoader").ofType(ClassLoader.class);
   LoadedApk_mBaseClassLoader = LoadedApk.field("mBaseClassLoader").ofType(ClassLoader.class);
   LoadedApk_mAppDir = LoadedApk.field("mAppDir").ofType(String.class);
   ContextImpl_mResources = ContextImpl.field("mResources").ofType(Resources.class);
   ContextImpl_mTheme = ContextImpl.field("mTheme").ofType(Theme.class);
   sIsIgnoreFailure = true;
   ContextThemeWrapper_mBase = ContextThemeWrapper.field("mBase").ofType(Context.class);
   sIsIgnoreFailure = false;
   ContextThemeWrapper_mTheme = ContextThemeWrapper.field("mTheme").ofType(Theme.class);
   try {
     if (VERSION.SDK_INT >= 17
         && ContextThemeWrapper.getmClass().getDeclaredField("mResources") != null) {
       ContextThemeWrapper_mResources =
           ContextThemeWrapper.field("mResources").ofType(Resources.class);
     }
   } catch (NoSuchFieldException e) {
     log.warn("Not found ContextThemeWrapper.mResources on VERSION " + VERSION.SDK_INT);
   }
   ContextWrapper_mBase = ContextWrapper.field("mBase").ofType(Context.class);
   Resources_mAssets = Resources.field("mAssets");
 }
 public static boolean defineAndVerify() throws AssertionArrayException {
   if (sIsReflectChecked) {
     return sIsReflectAvailable;
   }
   OpenAtlasHacks atlasHacks = new OpenAtlasHacks();
   try {
     Hack.setAssertionFailureHandler(atlasHacks);
     if (VERSION.SDK_INT == 11) {
       atlasHacks.onAssertionFailure(
           new HackAssertionException("Hack Assertion Failed: Android OS Version 11"));
     }
     allClasses();
     allConstructors();
     allFields();
     allMethods();
     if (atlasHacks.mExceptionArray != null) {
       sIsReflectAvailable = false;
       throw atlasHacks.mExceptionArray;
     }
     sIsReflectAvailable = true;
     return sIsReflectAvailable;
   } catch (Throwable e) {
     sIsReflectAvailable = false;
     log.error("HackAssertionException", e);
   } finally {
     Hack.setAssertionFailureHandler(null);
     sIsReflectChecked = true;
   }
   return sIsIgnoreFailure;
 }