获取apk文件内部版本信息

参考:http://blog.csdn.net/sowhat_ah/article/details/43955337#comments
http://blog.csdn.net/wzy_1988/article/details/44060525

需要apk-tools.jar org-apache-zip.jar 注意需要org-apache-zip.jar,导入ant.jar会报错

package test; 

import java.io.IOException;
import java.util.ArrayList;

import org.apkinfo.api.GetApkInfo;
import org.apkinfo.api.domain.ApkInfo;

public class ApkInfoTools { 
    public static void main(String[] args) {  
        try {  
            ArrayList listAPKInfo = GetApkInfo.listApkInfoByDir("E:\\android\\");  
            System.out.println(listAPKInfo.size());  
            System.out.println(listAPKInfo);  
              
            ApkInfo apkInfo = GetApkInfo.getApkInfoByFilePath("E:\\android\\排队_兴隆街道.apk");  
            System.out.println(apkInfo);  
            System.out.println(apkInfo.getVersionName());  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
    }  
}

你可能感兴趣的:(获取apk文件内部版本信息)