无需安装 apk 即可获取 Android .apk 文件 VersionName 或 VersionCode [英] Get Android .apk file VersionName or VersionCode WITHOUT installing apk
本文介绍了无需安装 apk 即可获取 Android .apk 文件 VersionName 或 VersionCode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在下载 AndroidManifest.xml 文件后以编程方式获取我的 apk 的版本代码或版本名称,无需安装.
How can I get programmatically get the version code or version name of my apk from the AndroidManifest.xml file after downloading it and without installing it.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxx.xx.xxx"
android:versionCode="1"
android:versionName="1.1" >
例如我想检查是否有新版本上传到我的 IIS 服务,在设备上安装后,如果不是新版本我不想安装.
For example I want to check if a new version is uploaded on my IIS service, after install it on device, if it is not a new version I don't want to install it.
推荐答案
以下从命令行对我有用:
Following worked for me from the command line:
aapt dump badging myapp.apk
<小时>
注意:aapt.exe 位于 SDK 的 build-tools
子文件夹中.例如:
<sdk_path>/build-tools/23.0.2/aapt.exe
这篇关于无需安装 apk 即可获取 Android .apk 文件 VersionName 或 VersionCode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文