public static boolean addFilesToExistingZipSevenZip(File tempApk,ArrayList<File> classesFiles){
  ArrayList<String> cmds=new ArrayList<String>();
  String seven[]=Zip.get7ZipCommand();
  for (  String str : seven) {
    cmds.add(str);
  }
  cmds.add(tempApk.getAbsolutePath());
  for (  File f : classesFiles)   cmds.add(f.getAbsolutePath());
  String[] cmd=new String[cmds.size()];
  for (int i=0; i < cmds.size(); i++)   cmd[i]=cmds.get(i);
  boolean sucess=(CmdUtils.runCommand(cmd) == 0);
  if (!sucess) {
    sucess=true;
    for (    File f : classesFiles) {
      try {
        sucess=sucess && ZipTools.isFileinZip(f.getName(),new ZipFile(tempApk));
      }
 catch (      ZipException e) {
        e.printStackTrace();
      }
    }
  }
  return sucess;
}

public static boolean addFilesToExistingZipSevenZip ( File tempApk , ArrayList < File > classesFiles ) { ArrayList < String > cmds = new ArrayList < String > ( ) ; String seven [ ] = Zip . get7ZipCommand ( ) ; for ( String str : seven ) { cmds . add ( str ) ; } cmds . add ( tempApk . getAbsolutePath ( ) ) ; for ( File f : classesFiles ) cmds . add ( f . getAbsolutePath ( ) ) ; String [ ] cmd = new String [ cmds . size ( ) ] ; for ( int i = 0 ; i < cmds . size ( ) ; i ++ ) cmd [ i ] = cmds . get ( i ) ; boolean sucess = ( CmdUtils . runCommand ( cmd ) == 0 ) ; if ( ! sucess ) { sucess = true ; for ( File f : classesFiles ) { try { sucess = sucess && ZipTools . isFileinZip ( f . getName ( ) , new ZipFile ( tempApk ) ) ; } catch ( ZipException e ) { e . printStackTrace ( ) ; } } } return sucess ; }
this method uses 7zip to add classes files to the given apk / jar the junk path are ignored ( classes file will be added to the root of the apk / jar )
