I've previously written an APK multichannel verification tool under the Windows platform based on the JRE environment, see http://blog.csdn.net/h3c4lenovo/article/details/10041047
This scenario is more restrictive, and after modifying the channel provider it is cumbersome to recompile the jar package.
So this time I wrote a multi-channel verification tool based on shell script and Python script, my development environment is Mac, so for Mac, this script does not need to configure the environment separately and need not compile, modify it to meet the needs of everyone.
cannal.sh
count=0rootpath=./toolspath=./tools/currentfoldername=${pwd##*/} #在tools路径下if ["$currentFolderName" = = "Tools"]; Thenrootpath=. /toolspath=./fiapkunzipfolder= "${rootpath}apkunzipfolder" androidmanifesttxt= "${rootpath}androidmanifest.txt" For line in $ (Find ${rootpath}*-prune-iname ' *.apk '); Do echo "Start check: $line" unzip-o-q-d $apkUnzipFolder $line Java-jar ${toolspath}axmlprinter2.jar $ Apkunzipfolder/androidmanifest.xml > $androidManifestTxtpython ${toolspath}xmlparsepy.pylet count= $count + 1doneif [-D $apkUnzipFolder]; Then RM-RF $apkUnzipFolderfiif [-f $ANDROIDMANIFESTTXT]; Then Rm-r $androidManifestTxtfiecho "Done, check ${count} files"
xmlparsepy.py
import os ToolsPath = './' If Os.path.basename (OS.GETCWD ()) = = ' Tools ': ToolsPath = '. /' from xml.dom import minidomxmldoc = Minidom.parse (toolspath+ ' AndroidManifest.txt ') itemlist = Xmldoc.getelementsbytagname (' Meta-data ') for s in itemlist:name = s.attributes[' android:name '].valuevalue = s.attributes[' android:value '].valueif name = = ' Umeng_channel ':p rint value
The main idea is to traverse the current directory, find all the directories under the *.apk end of the file, the unzip decompression, through Axmlprinter2.jar will be confused androidmanifest file decompile.
Use Python to parse XML to find the desired channel name
Resources Download:
http://download.csdn.net/detail/h3c4lenovo/8123251
APK Multi-channel verification tool under Mac