How to get application or package info from the apk file in the android application in the Android environment

前端 未结 4 1952
不思量自难忘°
不思量自难忘° 2020-12-28 17:36

Is it possible to get any information about the package or the application from the apk file without installing it in the Android environment?

相关标签:
4条回答
  • 2020-12-28 18:16

    An apk file is really just a zip archive with a different name. Rename x.apk to x.zip, where x is the name of the file, and you will be able to open it with any zip tool. It really depends on what information you're after as to whether you can find it in the apk file. I can say that you can access the AndroidManifest.xml file in which key information about the access rights of the app etc is stored in a fairly readable form, provided you know what you're looking for. What do you want to find? If you're looking for a readme or something then you almost certainly won't find it in there.

    0 讨论(0)
  • 2020-12-28 18:33
    $ aapt dump badging <path-to-apk>
    
    0 讨论(0)
  • 2020-12-28 18:34

    Check out this method from the PackageManager class:

    public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags)
    

    Retrieve overall information about an application package defined in a package archive file

    Might be helpful for you ;)

    0 讨论(0)
  • 2020-12-28 18:37

    unzipping and converting AndroidManifest.xml from binary form isn't the best way (IMHO)

    You act like you have an option. You don't, if all you have is the APK. The only solution, if all you have is the APK file, is based on what Sam pointed out.

    Of course, you can publish your metadata in a separate file alongside your APK, wherever you are getting your APK from (e.g., Web server).

    0 讨论(0)
提交回复
热议问题