How to print specified parameter when using aapt dump

I saw here that the team

aapt dump badging foo.apk 

prints all the details of the specified package.

Is it possible to print any property, say sdkversion? Something like

 aapt dump badging -sdkversion foo.apk 

PS I use the command line in windows.

EDIT

I am trying to save the package name in a variable. At the moment I have this code

 @echo off for /f "delims=" %%a in ('aapt dump badging foo.apk') do ( REM each line of the output ) 

I can get every line of output. Now I need to extract the package name from the string. For example, the first line

package: name = 'com.timeplusq.noob' versionCode = '15 'versionName =' 1.5 '

which is retrieved at the first iteration of the for loop. How to extract package name from it. I thought that string manipulations would be straightforward, it is not. How can I extract a package name from a string?

+1
android substring cmd aapt apk
Sep 14 '12 at 14:01
source share
1 answer

If you are running on a Unix system or have cygwin on Windows, you can try this command:

 aapt dump badging foo.apk | grep sdkVersion | sed -E "s/^[^:]+:\'(.*)\'$/\1/" 

regexp will retrieve the value of the string selected by grep

EDIT:

On a Windows system, you can use the following script saved as .cmd :

 @echo off set property=sdkVersion:'10' set property=%property:sdkVersion=% set property=%property:~2,-1% echo.%property% 
0
Sep 14 '12 at 14:23
source share



All Articles