Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apkpatch工具类diff 方法 新增类 执行不到的问题,见注释 #345

Open
zyl409214686 opened this issue May 17, 2017 · 0 comments

Comments

@zyl409214686
Copy link

zyl409214686 commented May 17, 2017

com.euler.patch.diff 包下DexDiffer类。

public DiffInfo diff(File newFile, File oldFile)
    throws IOException
  {
    DexBackedDexFile newDexFile = DexFileFactory.loadDexFile(newFile, 19, 
      true);
    DexBackedDexFile oldDexFile = DexFileFactory.loadDexFile(oldFile, 19, 
      true);
    DiffInfo info = DiffInfo.getInstance();
    //此行代码是否应该放入第一个for循环中,每次遍历都重置一下状态
    boolean contains = false;
    for (DexBackedClassDef newClazz : newDexFile.getClasses()) {
      Set oldclasses = oldDexFile
        .getClasses();
      for (DexBackedClassDef oldClazz : oldclasses) {
        if (newClazz.equals(oldClazz)) {
          compareField(newClazz, oldClazz, info);
          compareMethod(newClazz, oldClazz, info);
          contains = true;
          break;
        }
      }
      //1、场景是现在类有修改、并且有新增类
      if (contains)
        continue;
     //即使有新增类这里也不会被执行到。
      info.addAddedClasses(newClazz);
    }

    return info;
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant