Skip to content

Commit

Permalink
fix demo next launch error
Browse files Browse the repository at this point in the history
  • Loading branch information
yb.wang authored and yb.wang committed Nov 17, 2015
1 parent c884d84 commit 5d30893
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions bundle/src/ctrip/android/bundle/framework/Framework.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ static void startup() throws BundleException {
deleteDirectory(file);
}
file.mkdirs();

} else {
storeProfile();
} else {
restoreProfile();
}

long endTimeMillis = System.currentTimeMillis() - currentTimeMillis;
Expand Down Expand Up @@ -157,9 +157,7 @@ private static void storeProfile() {
private static void storeMetadata() {
try {
DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(new File(STORAGE_LOCATION, "meta")));

dataOutputStream.writeLong(nextBundleID);

dataOutputStream.flush();
dataOutputStream.close();
} catch (Throwable e) {
Expand All @@ -173,7 +171,6 @@ private static int restoreProfile() {
File file = new File(STORAGE_LOCATION, "meta");
if (file.exists()) {
DataInputStream dataInputStream = new DataInputStream(new FileInputStream(file));
int readInt = dataInputStream.readInt();
nextBundleID = dataInputStream.readLong();
dataInputStream.close();
File file2 = new File(STORAGE_LOCATION);
Expand All @@ -190,7 +187,7 @@ private static int restoreProfile() {
}
i++;
}
return readInt;
return 1;
}
// System.out.println("Profile not found, performing clean start ...");
log.log("Profile not found, performing clean start ...", Logger.LogLevel.DBUG);
Expand Down
2 changes: 1 addition & 1 deletion sample/src/ctrip/android/sample/BundleBaseApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void onCreate() {
String lastBundleKey = sharedPreferences.getString("last_bundle_key", "");
bundleKey = buildBundleKey();
if (!TextUtils.equals(bundleKey, lastBundleKey)) {
properties.put("osgi.init", "true");
properties.put("ctrip.bundle.init", "true");
isDexInstalled = false;
HotPatchManager.getInstance().purge();
}
Expand Down

0 comments on commit 5d30893

Please sign in to comment.