background:
On the one already introduced how to use the bat script runs directly py file and get the results
https://www.cnblogs.com/reseelei-despair/p/11082060.html
Because the machine itself py environment, so you can run, in order to let the computer do not py environment can also use this tool, consider using pyqt5 of the tool interface, drag and drop print-related information directly into the tool
Ideas:
Two py files, aapt_tools responsible for invoking the installation package aapt query information, qt_tools2 responsible for the tool interface of the display
Code:
qt part I have not started school, so this reference
To modify the code portion
qt_tools2.py
import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * import re from aapt_tools import ApkInfo class Fennbk_com(QWidget): def __init__(self): super(Fennbk_com, self).__init__() # Window title self.setWindowTitle('aapt_tools') # Define the window size self.resize(300, 60) self.QLabl = QLabel(self) self.QLabl.setGeometry(0, 0, 4000, 50) # Method call Drops self.setAcceptDrops(True) # Mouse drag events def wear delicate guy (self, evn) self.QLabl.setText ( ' file path: \ n- ' + evn.mimeData () text ().) c = evn.mimeData().text() d = re.sub("file:///", "", c) apk_info = ApkInfo(r"%s"%d) self.QLabl.setText("Activity:%s \napkName:%s \nsdkVersion:%s \ntargetSdkVersion:%s" % (apk_info.get_apk_activity(),apk_info.get_apk_base_info(),apk_info.get_apk_sdkVersion(),apk_info.get_apk_targetSdkVersion())) # Mouse release events function evn.accept() if __name__ == "__main__": app = QApplication(sys.argv) fennbk = Fennbk_com () fennbk.show() sys.exit(app.exec_())
aapt_tools.py
# -*- coding: utf-8 -*- import re import subprocess import os class ApkInfo: def __init__(self, apk_path): self.apkPath = apk_path selfaaptpath = selfgetaapt () @staticmethod def get_aapt(): you = os.getcwd () dir2 = dir + r"\aapt.exe" print(dir2) return dir2 def get_apk_base_info(self): p = subprocess.Popen(self.aapt_path + " dump badging %s" % self.apkPath, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() match = re.compile("package: name='(\S+)'").match(output.decode()) if not match: raise Exception("can't get packageinfo") package_name = match.group(1) return package_name def get_apk_activity(self): p = subprocess.Popen(self.aapt_path + " dump badging %s" % self.apkPath, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() match = re.compile("launchable-activity: name='(\S+)'").search(output.decode()) if match is not None: return match.group(1) def get_apk_sdkVersion(self): p = subprocess.Popen(self.aapt_path + " dump badging %s" % self.apkPath, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() match = re.compile("sdkVersion:'(\S+)'").search(output.decode()) return match.group(1) def get_apk_targetSdkVersion(self): p = subprocess.Popen(self.aapt_path + " dump badging %s" % self.apkPath, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() match = re.compile("targetSdkVersion:'(\S+)'").search(output.decode()) return match.group(1)
After completion of the above-described two py aapt.exe and files in the same folder, using the encapsulation pyinstaller
Packaging Pit:
1. Open the program prompts: it could not find or load the Qt platform plugin "windows"
reference
https://blog.csdn.net/qq_36100960/article/details/79413085
I would platforms files in the plugins folder to the project file directory (To copy an entire folder), problem solving ...
2. Packaging occurred during Can not find existing PyQt5 plugin directories, the following information
Exception:
Cannot find existing PyQt5 plugin directories
Paths checked: C:\qt64\qt_1544645195969\_h_env\Library\plugins
C drive not found this path, so I created this path in accordance with the relevant folder, and the pyqt5.dll and pyqt5qmlplugin.dull thrown in ... so resolved
Using the results as shown in FIG.
Drag ago
After dragged
bug:
1. When will the file lost Caton
2. If the installation package is downloaded repeat the installation package, the package name with the suffix (1), such apk dragged into the tool will cause the program to stop running directly