• 批量安装APK,可是没解决APK名称为中文的问题


    package studyjava;
    
    
    import java.io.BufferedInputStream;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    
    import org.omg.SendingContext.RunTime;
    
    public class install {
        public static void main(String[] args) throws Exception
        {   
            String dir="D:\downapp\";
            File f1=new File(dir);
            String[] apkname=f1.list();
            for(int i=0;i<apkname.length;i++)
            {   
                if(installapp(dir+apkname[i]))
                    System.out.println(apkname[i]+"安装成功");
                else
                    System.out.println(apkname[i]+"没安装成功,或已经安装");
    
            }
            
    
        }
        public static boolean installapp(String path) throws IOException, Exception
        {   
            String[] b=new String[1024];
            Process p=Runtime.getRuntime().exec("adb install "+path);
            Thread.sleep(4000);
            InputStream in=p.getInputStream();
            BufferedReader br=new BufferedReader(new InputStreamReader(in));
            String str;
            int i=0;
            while((str=br.readLine())!=null)
            {
                if(str.indexOf("Success")!=-1)
                    i=1;
            }
            if(i==1)
                return true;
            else
                return false;
        }
    
    }
  • 相关阅读:
    【图论】第k短路
    【图论】差分约束系统
    【图论】最短路
    【图论】Johnson算法
    HDU5878
    HDU5900
    pow的小事不简单
    math汇总
    Bellman-Ford最短路径
    图的遍历
  • 原文地址:https://www.cnblogs.com/penghong2014/p/4497923.html
Copyright © 2020-2023  润新知