0

我在使用命令时遇到问题adb push。当我在第一次迭代时不执行循环时,其余部分本身。

任何想法?

public void export_APK(String dir, String nom_fich, String dir_padre) throws IOException, InterruptedException{ 


        Process p6;

        Runtime.getRuntime().exec("cmd /c adb wait-for-device");               
        Runtime.getRuntime().exec("cmd /c adb install -r " + dir);

            Runtime.getRuntime().exec("adb shell rm -r /sdcard/Alumno");        
            Runtime.getRuntime().exec("adb shell mount /sdcard");
            Runtime.getRuntime().exec("adb shell mkdir /sdcard/Alumno");            



  for (Integer i=1;i<6;i++){                              
    p6 = Runtime.getRuntime().exec("adb push c:\image\photo" + i + " /sdcard/Alumno/Actividad"+i);            
    p6.waitFor();                
  }                                     
} 
4

1 回答 1

1

// 你的 for 循环是错误的

   for (int i=1;i<6;i++){                              
    Process p6 = Runtime.getRuntime().exec("adb push c:\image\photo" + i + " /sdcard/Alumno/Actividad"+i);            
    p6.waitFor(); 
Log.d("Inside loop","---i==="+i);

      } 
于 2012-05-21T13:17:50.050 回答