zoukankan      html  css  js  c++  java
  • 获取app 信息

    可以通过appt.exe 来获取app的所有信息

    public String versionName(String apkPath) {
            String versionName = "";
            InputStream inputStream = null;
            BufferedReader bufferedReader = null;
            try {
                Runtime rt = Runtime.getRuntime();
                /*String order = ReadPro.getValue("aaptPath") + " d badging ""
                        + apkPath + """;*/
                String order = null;
                if (os.toLowerCase().contains("windows")) {
                    order = ReadPro.getValue("aaptPath") + " d badging ""+ apkPath + """;
                }else {
                    order = ReadPro.getValue("aaptPath") + " d badging " + apkPath ;
                }
                Process proc = rt.exec(order);
                new StreamGobbler(proc.getErrorStream()).start();
                inputStream = proc.getInputStream();
                bufferedReader = new BufferedReader(new InputStreamReader(
                        inputStream, "UTF-8"));
                String line = null;
                while ((line = bufferedReader.readLine()) != null) {
                    if (line.contains("versionName")) {
                        String str1 = line
                                .substring(line.indexOf("versionName") + 13);
                        String str2 = str1.substring(0, str1.indexOf("'"));
                        versionName = str2;
                        break;
                    }
                }
            } catch (Throwable e) {
                e.printStackTrace();
            } finally {
    
                try {
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (bufferedReader != null) {
                        bufferedReader.close();
                    }
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
    
            }
            return versionName;
        }
  • 相关阅读:
    javascript线性渐变2
    javascript无缝滚动2
    javascript Object对象
    javascript无缝滚动
    javascript图片轮换2
    javascript图片轮换
    用C/C++写CGI程序
    linux shell 的 for 循环
    重磅分享:微软等数据结构+算法面试100题全部答案完整亮相
    查看linux服务器硬盘IO读写负载
  • 原文地址:https://www.cnblogs.com/phyxis/p/5474006.html
Copyright © 2011-2022 走看看