Skip to content

Commit

Permalink
Merge branch 'dev' into gradle/2.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawulu committed Jun 21, 2017
2 parents a06e949 + 7edaad6 commit b88950a
Show file tree
Hide file tree
Showing 26 changed files with 586 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ public synchronized void optDexFile() {
//dexFile = DexFileCompat.loadDex(RuntimeVariables.androidApplication,bundleFile.getAbsolutePath(), odexFile.getAbsolutePath(), 0);
}
}
if(Framework.isDeubgMode()){
optPatchDexFile();
}
//9月份版本明天发布先不集成
// isDexOptDone = checkDexValid(dexFile);
isDexOptDone = true;
Expand Down Expand Up @@ -675,29 +678,30 @@ public String findLibrary(String name){
}

private Class findPatchClass(String clazz,ClassLoader cl){
if(patchDexFileForDebug==null){
File debugBundleDir = new File(RuntimeVariables.androidApplication.getExternalFilesDir("debug_storage"),location);
File patchFile = new File(debugBundleDir,"patch.zip");
if(patchFile.exists()){
try {
// patchDexFileForDebug = AndroidRuntime.getInstance().loadDex(RuntimeVariables.androidApplication,
// patchFile.getAbsolutePath(), new File(debugBundleDir,"patch.dex").getAbsolutePath(), 0,true);
//兼容7。0 动态部署过后不同classloader下对classcast
File internalDebugBundleDir = new File(new File(RuntimeVariables.androidApplication.getFilesDir(),"debug_storage"),location);
internalDebugBundleDir.mkdirs();
RuntimeVariables.sDexLoadBooster.getClass().getDeclaredMethod("loadDex",Context.class,String.class, String.class, int.class, boolean.class).invoke(
RuntimeVariables.sDexLoadBooster,RuntimeVariables.androidApplication, patchFile.getAbsolutePath(), new File(internalDebugBundleDir,"patch.dex").getAbsolutePath(), 0,true);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
}
if(patchDexFileForDebug!=null){
return patchDexFileForDebug.loadClass(clazz,cl);
}
return null;
}

private void optPatchDexFile() {
File debugBundleDir = new File(RuntimeVariables.androidApplication.getExternalFilesDir("debug_storage"), location);
File patchFile = new File(debugBundleDir,"patch.zip");
if(patchFile.exists()){
try {
// patchDexFileForDebug = AndroidRuntime.getInstance().loadDex(RuntimeVariables.androidApplication,
// patchFile.getAbsolutePath(), new File(debugBundleDir,"patch.dex").getAbsolutePath(), 0,true);
//兼容7。0 动态部署过后不同classloader下对classcast
File internalDebugBundleDir = new File(new File(RuntimeVariables.androidApplication.getFilesDir(),"debug_storage"),location);
internalDebugBundleDir.mkdirs();
patchDexFileForDebug= (DexFile)RuntimeVariables.sDexLoadBooster.getClass().getDeclaredMethod("loadDex", Context.class, String.class, String.class, int.class, boolean.class).invoke(
RuntimeVariables.sDexLoadBooster,RuntimeVariables.androidApplication, patchFile.getAbsolutePath(), new File(internalDebugBundleDir,"patch.dex").getAbsolutePath(), 0,true);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
}

public String getDebugPatchFilePath(){
File debugBundleDir = new File(RuntimeVariables.androidApplication.getExternalFilesDir("debug_storage"),location);
File patchFile = new File(debugBundleDir,"patch.zip");
Expand Down
10 changes: 6 additions & 4 deletions atlas-docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
* [dexpatch使用教程](update/dexpatch_use_guide.md)
* [一些限制](update/guide.md)
* FAQ
* [gradle配置](atlas_gradle_apk/atlas_atlas_gradle_apk.md)
* [启动代码分析1](atlas_start/atlas_start_1.md)
* [启动代码分析2](atlas_start/atlas_start_2.md)
* [问答](faq/question.md)
* [问答](faq/question.md)
* [故障排查](faq/help.md)
* 源码分析
* [Atlas之Gradle配置](code_read/atlas_gradle_apk/atlas_atlas_gradle_apk.md)
* [Atlas之启动过程(一)](code_read/atlas_start/atlas_start_1.md)
* [Atlas之启动过程(二)](code_read/atlas_start/atlas_start_2.md)
* [Atlas之Bundle加载过程](code_read/atlas_bundle_load/atlas_bundle_load.md)

Loading

0 comments on commit b88950a

Please sign in to comment.