【aapt-操作】使用aapt命令来查看已打包的apk的版本号versionCode/版本名versionName

问题描述:

想要查看已经被打包了的apk的版本信息

参考:https://blog.csdn.net/ljz2009y/article/details/19409319

使用命令:

aapt dump badging ******.apk

CMD终端报错:

D:\>aapt dump badging xxxxxx.apk
'aapt' 不是内部或外部命令,也不是可运行的程序或批处理文件。

参考:https://www.jianshu.com/p/31a7c4ac9cae

解决问题:

添加环境变量或者直接进入SDK的安装目录中找到aapt.exe所在目录(如:我的位于:D:\Program\SDK\build-tools\28.0.3)

再次运行上述命令,得到结果如下:

D:\Program\SDK\build-tools\28.0.3>aapt dump badging D:\xxxxxx.apk
package: name='com.***.****' versionCode='25' versionName='1.0.11' compileSdkVersion='28'         // 版本信息
compileSdkVersionCodename='9'
sdkVersion:'21'
targetSdkVersion:'28'
uses-permission: name='android.permission.INTERNET'          // 权限信息
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.MOUNT_UNMOUNT_FILESYSTEMS'
...
uses-permission: name='android.permission.REQUEST_INSTALL_PACKAGES'
application-label:'MyApp'
application-label-af:'MyApp'
application-label-am:'MyApp'
application-label-ar:'MyApp'
...
application-label-zu:'MyApp'
application-icon-120:'res/drawable-hdpi-v4/ic_launcher.png'
application-icon-160:'res/drawable-hdpi-v4/ic_launcher.png'
application-icon-240:'res/drawable-hdpi-v4/ic_launcher.png'
application-icon-320:'res/drawable-xhdpi-v4/ic_launcher.png'
application-icon-480:'res/drawable-xxhdpi-v4/ic_launcher.png'
application-icon-640:'res/drawable-xxxhdpi-v4/ic_launcher.png'
application-icon-65534:'res/drawable-hdpi-v4/ic_launcher.png'
application: label='' icon='res/drawable-hdpi-v4/ic_launcher.png'
launchable-activity: name='com.xxx.xxxxx.activity.WelcomeActivity'  label='' icon=''        // 主启动Activity
feature-group: label=''
  uses-feature: name='android.hardware.camera'
  uses-implied-feature: name='android.hardware.camera' reason='requested android.permission.CAMERA permission'
  uses-feature: name='android.hardware.faketouch'
  uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'
  uses-feature: name='android.hardware.location'
  uses-implied-feature: name='android.hardware.location' reason='requested android.permission.ACCESS_COARSE_LOCATION permission, and requested android.permission.ACCESS_FINE_LOCATION permission'
  uses-feature: name='android.hardware.microphone'
  uses-implied-feature: name='android.hardware.microphone' reason='requested android.permission.RECORD_AUDIO permission'
  uses-feature: name='android.hardware.telephony'
  uses-implied-feature: name='android.hardware.telephony' reason='requested a telephony permission'
  uses-feature: name='android.hardware.wifi'
  uses-implied-feature: name='android.hardware.wifi' reason='requested android.permission.ACCESS_WIFI_STATE permission, and requested android.permission.CHANGE_WIFI_STATE permission'
main
other-activities
other-receivers
other-services
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--' 'af' 'am' 'ar' 'as' 'az' ......'te' 'th' 'tl' 'tr' 'uk' 'ur' 'uz' 'vi' 'zh' 'zh-CN' 'zh-HK' 'zh-MO' 'zh-TW' 'zu'
densities: '120' '160' '240' '320' '480' '640' '65534'

 

 

附:aapt 命令查看apk包名(aapt命令大全)

附:代码中获取Android的VersionCode和VersionName信息

你可能感兴趣的:(命令)