Check APK Version using Java

How to check APK version using Java?

package test;

public class CekVersi_apk{
public static void main(String[] args) throws IOException {
//First of all, you must download aapt.exe. You can find it in google. Then, you can put in directory
String aapt = “\”C:\Users\edward\aapt.exe\””;  //This is my path of appt.exe in desktop
//Then, put your APK to directory
String apk = “\”C:\Users\edward\AndroidApplication.apk\””; //This is my path of apk in desktop
//After that, we will using this script (aapt dump badging [APK_name] )
String cmd = aapt + ” dump badging ” + apk;
//Execute cmd
Process cutVideo = Runtime.getRuntime().exec(cmd);
//Result after execute
InputStream is = cutVideo.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
//System.out.println(“Result  of cmd ipconfig = “);
String barisPertama = null;
while( ( line = br.readLine() ) != null /&& i==0/) {
barisPertama = line;
String kata[] = barisPertama.split(” “);
for(int x=0; x< kata.length;x++) {
System.out.println(kata[2] + kata[3]);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.