Source:
private boolean initializeApplicationHelper() { setupSandbox(); ResourceTable global = platform.getGlobalResourceTable(); ResourceTable upgrade = platform.getUpgradeResourceTable(); ResourceTable recovery = platform.getRecoveryTable(); logTable("Global", global); logTable("Upgrade", upgrade); logTable("Recovery", recovery); if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) { global.rollbackCommits(); logTable("Global after rollback", global); } if (upgrade.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) { upgrade.rollbackCommits(); logTable("Upgrade after rollback", upgrade); } if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNSTAGED) { global.repairTable(upgrade); } Resource profile = global.getResourceWithId(CommCarePlatform.APP_PROFILE_RESOURCE_ID); if (profile != null && profile.getStatus() == Resource.RESOURCE_STATUS_INSTALLED) { platform.initialize(global, false); try { Localization.setLocale( getAppPreferences().getString(CommCarePreferences.PREFS_LOCALE_KEY, "default")); } catch (UnregisteredLocaleException urle) { Localization.setLocale(Localization.getGlobalLocalizerAdvanced().getAvailableLocales()[0]); } initializeStylizer(); try { HybridFileBackedSqlHelpers.removeOrphanedFiles(buildAndroidDbHelper().getHandle()); } catch (SessionUnavailableException e) { Logger.log(LogTypes.SOFT_ASSERT, "Unable to get app db handle to clear orphaned files"); } return true; } String failureReason = profile == null ? "profle being null" : "profile status value " + String.valueOf(profile.getStatus()); Logger.log(LogTypes.TYPE_ERROR_STORAGE, "Initializing application failed because of " + failureReason); return false; }

Target:
private boolean initializeApplicationHelper() { setupSandbox(); ResourceTable global = platform.getGlobalResourceTable(); ResourceTable upgrade = platform.getUpgradeResourceTable(); ResourceTable recovery = platform.getRecoveryTable(); logTable("Global", global); logTable("Upgrade", upgrade); logTable("Recovery", recovery); if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) { global.rollbackCommits(); logTable("Global after rollback", global); } if (upgrade.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) { upgrade.rollbackCommits(); logTable("Upgrade after rollback", upgrade); } if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNSTAGED) { global.repairTable(upgrade); } Resource profile = global.getResourceWithId(CommCarePlatform.APP_PROFILE_RESOURCE_ID); if (profile != null && profile.getStatus() == Resource.RESOURCE_STATUS_INSTALLED) { platform.initialize(global, false); try { Localization.setLocale( getAppPreferences().getString(CommCarePreferences.PREFS_LOCALE_KEY, "default")); } catch (UnregisteredLocaleException urle) { Localization.setLocale(Localization.getGlobalLocalizerAdvanced().getAvailableLocales()[0]); } initializeStylizer(); try { HybridFileBackedSqlHelpers.removeOrphanedFiles(buildAndroidDbHelper().getHandle()); } catch (SessionUnavailableException e) { Logger.log(LogTypes.SOFT_ASSERT, "Unable to get app db handle to clear orphaned files"); } return true; } String failureReason = profile == null ? "profle being null" : "profile status value " + String.valueOf(profile.getStatus()); Logger.log(LogTypes.TYPE_RESOURCES, "Initializing application failed because of " + failureReason); return false; }