Pure Java Gets the package name, version number, icon in the APK file

Source: Internet
Author: User

Concise: No more than 5 Java files

Dependency: dependent on Aapt.exe only

Support: Windows only

Function: Get the package name, version number, icon file "Get stream to File system" in the APK anthology with pure Java

Principle: Compare the previous article by Decompile and then parse Androidmanifest.xml way, this way is more simple, through simulation execution aapt intercept cmd output and organize to obtain information.

The attachment is the source code, the Test/demo is the demo, the output is the compiled jar file.

Refer to open source projects:

http://code.google.com/p/cfuture09-apkutil/

This project has been expanded on this project to support the extraction of icons.

Code snippet:

Java code
 Public Static voidMain (string[] args) {Try{String Apkpath= "D:\\DEFAULTAPKTEMPSAVEFOLDER\\3G Android Market \\com.jiubang.market.apk"; if(Args.length > 0) {Apkpath= Args[0]; } apkinfo Apkinfo=Newapkutil (). Getapkinfo (Apkpath); //Print the information obtainedSystem.out.println (Apkinfo); //get icon and save to specified locationiconutil.extractfilefromapk (Apkpath, Apkinfo.getapplicationicon (), "d:\\defaultapktempsavefolder\\3g Android Market \ \ Crawler\\icon.png "); } Catch(Exception e) {e.printstacktrace (); }    }
    • Apkutil.zip (429.3 KB)

Pure Java Gets the package name, version number, icon in the APK file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.