[go: up one dir, main page]

CN112099880A - Scenario-driven application reduction method and system - Google Patents

Scenario-driven application reduction method and system Download PDF

Info

Publication number
CN112099880A
CN112099880A CN202010809489.2A CN202010809489A CN112099880A CN 112099880 A CN112099880 A CN 112099880A CN 202010809489 A CN202010809489 A CN 202010809489A CN 112099880 A CN112099880 A CN 112099880A
Authority
CN
China
Prior art keywords
information
file
apk
class
list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010809489.2A
Other languages
Chinese (zh)
Other versions
CN112099880B (en
Inventor
黄罡
马郓
景翔
崔磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University
Original Assignee
Peking University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University filed Critical Peking University
Priority to CN202010809489.2A priority Critical patent/CN112099880B/en
Publication of CN112099880A publication Critical patent/CN112099880A/en
Application granted granted Critical
Publication of CN112099880B publication Critical patent/CN112099880B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a method and a system for reducing a scene-driven application program, and belongs to the field of computers. The method comprises the following steps: acquiring stack information in an APP starting process and an API calling process to form a stack information file; analyzing the stack information file to obtain a class list, a resource list and a shared library list; taking the class list, the resource list and the shared library list as first information; analyzing the APK file to acquire second information in the APK file; comparing the second information in the APK file with the first information in the stack information file, and removing the first information from the second information in the APK file to obtain a reduction set; and removing the reduction set from the second information in the APK file to generate a new APK file. By using the method provided by the application, the original APK can be reduced to obtain a new APK so as to reduce the volume of the APK, and the APP starting speed is faster after the APK is installed.

Description

场景驱动的应用程序约减方法和系统Scenario-driven application reduction method and system

技术领域technical field

本申请实施例涉及计算机技术领域,具体而言,涉及一种场景驱动的应用程序约减方法和系统。The embodiments of the present application relate to the field of computer technologies, and in particular, to a scene-driven application program reduction method and system.

背景技术Background technique

在移动互联网时代,随着智能手机的普及和无线网络的发展,移动应用已成为人们访问移动互联网的主要方式。In the era of mobile Internet, with the popularization of smart phones and the development of wireless networks, mobile applications have become the main way for people to access the mobile Internet.

现有技术中,在终端上启动APP后,终端上的Android应用程序在调用API接口时,会加载整个APK,APK是Android安装包。In the prior art, after the APP is started on the terminal, when the Android application on the terminal calls the API interface, the entire APK will be loaded, and the APK is the Android installation package.

而实际上,调用API接口仅需要APK内小部分代码和资源的支持,加载整个APK占用了较大的存储资源,并且也拖慢了APP启动速度。In fact, calling the API interface only requires the support of a small part of the code and resources in the APK. Loading the entire APK takes up a large amount of storage resources, and also slows down the startup speed of the APP.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种场景驱动的应用程序约减方法和系统,旨在解决APK占用存储资源大且APP启动速度慢的问题。The embodiments of the present application provide a scene-driven application program reduction method and system, which aims to solve the problems that the APK occupies a large amount of storage resources and the APP startup speed is slow.

本申请实施例第一方面在于提供一种场景驱动的应用程序约减方法,所述方法包括:A first aspect of the embodiments of the present application is to provide a scene-driven application program reduction method, the method comprising:

获取APP启动过程与API调用过程中的堆栈信息,形成堆栈信息文件,其中,所述堆栈信息文件包括方法参数与返回值;Acquire the stack information in the APP startup process and the API calling process, and form a stack information file, wherein the stack information file includes method parameters and return values;

对所述堆栈信息文件中的返回值进行解析,得到类列表;对所述堆栈信息文件中的方法参数进行解析,得到资源列表与共享库列表;将所述类列表、所述资源列表与所述共享库列表作为第一信息;The return value in the stack information file is parsed to obtain a class list; the method parameters in the stack information file are parsed to obtain a resource list and a shared library list; the class list, the resource list and all The shared library list is used as the first information;

对APK文件进行分析,获取所述APK文件中的第二信息,其中,所述第二信息包括类、资源与共享库;The APK file is analyzed to obtain second information in the APK file, wherein the second information includes classes, resources and shared libraries;

将所述APK文件中的第二信息与所述堆栈信息文件中的第一信息进行比对,从所述APK文件中的第二信息剔除出现的第一信息,得到约减集合;The second information in the APK file is compared with the first information in the stack information file, and the first information that appears is removed from the second information in the APK file to obtain a reduction set;

从所述APK文件中的第二信息中剔除所述约减集合,生成新的APK文件。The reduction set is eliminated from the second information in the APK file to generate a new APK file.

可选地,获取APP启动过程与API调用过程中的堆栈信息,形成堆栈信息文件,具体包括:Optionally, obtain the stack information in the APP startup process and the API calling process to form a stack information file, which specifically includes:

基于动态分析技术和/或静态分析技术,将所述Android应用程序的运行阶段分为多个子阶段,通过分子阶段的方式,来获取所述APP启动过程与所述API调用过程中的堆栈信息,其中,所述子阶段至少包括所述APP启动阶段与所述API调用阶段;Based on dynamic analysis technology and/or static analysis technology, the running stage of the Android application is divided into multiple sub-stages, and the stack information in the APP startup process and the API calling process is obtained by means of molecular stages, Wherein, the sub-stage includes at least the APP startup stage and the API calling stage;

基于动态分析技术和/或静态分析技术,将所述Android应用程序产生的信息分为多个子信息,通过分别获取多个子信息的方式,来获取所述APP启动过程与所述API调用过程中的堆栈信息,其中,所述堆栈信息包括多个子信息;Based on dynamic analysis technology and/or static analysis technology, the information generated by the Android application is divided into multiple sub-information, and the information between the APP startup process and the API calling process is obtained by separately acquiring multiple sub-information. stack information, wherein the stack information includes multiple sub-information;

基于动态分析技术和/或静态分析技术,将所述Android应用程序产生的信息标注,分为关注类与非关注类,通过关注类或非关注类,来获取所述APP启动过程与所述API调用过程中的堆栈信息。Based on the dynamic analysis technology and/or the static analysis technology, the information generated by the Android application is marked into a concern class and a non-concerned class, and the APP startup process and the API are obtained through the concerned class or the non-concerned class. Stack information during the calling process.

可选地,所述APK文件通过以下步骤获取:Optionally, the APK file is obtained through the following steps:

将Android应用程序中的源代码经过Java编译器编译,生成多个class文件;The source code in the Android application is compiled by the Java compiler to generate multiple class files;

将Android应用程序中的资源文件进行编译,生成编译后的资源文件,其中,所述资源文件包括若干资源与共享库;Compile the resource file in the Android application to generate a compiled resource file, wherein the resource file includes several resources and a shared library;

将多个class文件通过dx工具生成Dex文件,其中,所述Dex文件包括若干类以及与若干类相关的依赖类;Dex files are generated by multiple class files through the dx tool, wherein the Dex files include several classes and dependent classes related to several classes;

将所述编译后的资源文件与所述Dex文件进行打包压缩,生成APK文件。The compiled resource file and the Dex file are packaged and compressed to generate an APK file.

可选地,还包括:Optionally, also include:

根据所述类列表中的每个类,在Dex文件中查询与每个类相关的依赖类;According to each class in the class list, query the dependent class related to each class in the Dex file;

将所述每个类相关的依赖类与每个类对应,保存至所述类列表中。The dependent classes related to each class are corresponding to each class, and stored in the class list.

可选地,从所述APK文件中的第二信息中剔除约减集合,生成新的APK文件,具体包括:Optionally, the reduction set is removed from the second information in the APK file to generate a new APK file, which specifically includes:

针对所述资源与所述共享库,删除所述约减集合中出现的所述资源与所述共享库,生成新的资源文件;For the resource and the shared library, delete the resource and the shared library that appear in the reduction set, and generate a new resource file;

针对所述类,读取所述Dex文件中的类,删除所述约减集合中的出现的类,生成新的Dex文件;For the class, read the class in the Dex file, delete the class that appears in the reduction set, and generate a new Dex file;

根据所述新的Dex文件与所述新的资源文件生成所述新的APK文件。The new APK file is generated according to the new Dex file and the new resource file.

可选地,还包括:Optionally, also include:

将新的APK与APK对应的Dex文件安装至终端上,生成APP;Install the new APK and the Dex file corresponding to the APK on the terminal to generate an APP;

启动所述APP,终端检测并加载所述APK对应的Dex文件,以暴露API接口;Start the APP, and the terminal detects and loads the Dex file corresponding to the APK to expose the API interface;

调用所述API接口,获取调用结果;Call the API interface to obtain the call result;

根据所述调用结果,判断新的APK能否支持所述API接口的正常调用,若能正常调用,则结束约减工作;若无法正常调用,则分析Android日志,查找缺失的信息,其中,所述Android日志在启动APP后产生,缺失的信息包括类、资源与共享库;According to the call result, it is judged whether the new APK can support the normal call of the API interface. If it can be called normally, the reduction work is ended; if it cannot be called normally, the Android log is analyzed to find the missing information. The Android log described above is generated after launching the APP, and the missing information includes classes, resources and shared libraries;

根据所述缺失的信息,调整所述原约减集合,得到新的约减集合;According to the missing information, adjust the original reduction set to obtain a new reduction set;

根据所述新的约减集合,重复上述步骤进行测试,直至新的APK能够支持所述API接口正常调用。According to the new reduction set, the above steps are repeated for testing until the new APK can support the normal invocation of the API interface.

可选地,根据所述缺失的信息,调整所述原约减集合,得到新的约减集合,还包括:Optionally, according to the missing information, adjusting the original reduction set to obtain a new reduction set, further comprising:

在所述原约减集合中注释所述缺失的信息;annotating the missing information in the original reduction set;

在更新所述原约减集合时,忽略被注释的所述缺失的信息。When updating the original reduction set, the missing information that is annotated is ignored.

可选地,分析Android日志,查找缺失的信息,具体包括:Optionally, analyze Android logs for missing information, including:

对所述Android应用程序中的各个应用包名添加上对应的应用包启动时的进程ID标识;其中,所述Android日志中的各个日志条目与各个进程ID标识之间存在映射关系;Each application package name in the Android application program is added with the process ID mark when the corresponding application package is started; wherein, there is a mapping relationship between each log entry in the Android log and each process ID mark;

根据所述进程ID标识从所述各个日志条目中筛选出目标日志条目;Filter out the target log entry from the respective log entries according to the process ID identifier;

根据所述目标日志条目,从所述约减集合中匹配出所述缺失的信息,包括:According to the target log entry, the missing information is matched from the reduced set, including:

根据所述目标日志条目,从约减集合中匹配出缺失的信息,具体包括:According to the target log entry, the missing information is matched from the reduction set, which specifically includes:

在所述目标日志条目下,通过正则表达式,匹配出缺失的信息;Under the target log entry, the missing information is matched through a regular expression;

若无法通过正则表达式匹配出缺失的信息,则对约减集合通过二分法进行查找,以确定缺失的信息。If the missing information cannot be matched by the regular expression, the reduction set is searched by the binary method to determine the missing information.

可选地,将repick列表导入终端;Optionally, import the repick list into the terminal;

将所述repick列表中的信息进行保留,其中repick列表至少包括类、资源与共享库的信息。The information in the repick list is retained, wherein the repick list at least includes information of classes, resources and shared libraries.

本申请实施例第二方面在于提供一种场景驱动的应用程序约减系统,包括:A second aspect of the embodiments of the present application is to provide a scenario-driven application program reduction system, including:

堆栈信息获取模块,获取APP启动过程与API调用过程中的堆栈信息,形成堆栈信息文件,其中,所述堆栈信息文件包括方法参数与返回值;The stack information acquisition module acquires the stack information in the APP startup process and the API calling process, and forms a stack information file, wherein the stack information file includes method parameters and return values;

堆栈信息解析模块,对所述堆栈信息文件中的返回值进行解析,得到类列表;对所述堆栈信息文件中的方法参数进行解析,得到资源列表与共享库列表;将所述类列表、所述资源列表与所述共享库列表作为第一信息;The stack information parsing module parses the return value in the stack information file to obtain a class list; parses the method parameters in the stack information file to obtain a resource list and a shared library list; The resource list and the shared library list are used as the first information;

APK文件解析模块,对APK文件进行分析,获取所述APK文件中的第二信息,其中,所述第二信息包括类、资源与共享库;an APK file parsing module, analyzes the APK file, and obtains second information in the APK file, wherein the second information includes classes, resources and shared libraries;

约减集合生成模块,将所述APK文件中的第二信息与所述堆栈信息文件中的第一信息进行比对,从所述APK文件中的第二信息剔除出现的第一信息,得到约减集合;The reduction set generation module compares the second information in the APK file with the first information in the stack information file, removes the first information that appears from the second information in the APK file, and obtains approximately minus set;

APK文件生成模块,从所述APK文件中的第二信息中剔除所述约减集合,生成新的APK文件。An APK file generation module, which removes the reduction set from the second information in the APK file, and generates a new APK file.

采用本申请提供的一种API驱动的Android应用程序约减方法和系统,可以自动获取APP启动过程和API调用过程产生的第一信息,与整个APK文件产生的第二信息,将第一信息与第二信息进行约减,从而得到约减集合,再将第二信息与约减集合进行约减,从而得到调用API接口时所需的必要信息,并利用这部分必要信息生成新的APK。在新的APK中,删除了调用API接口时的不必要信息,从而节省了存储资源,另外,由于不必要信息的删除,使得整个APK的占用体积更小,从而加快了APP启动速度。By adopting the API-driven Android application reduction method and system provided by the present application, the first information generated by the APP startup process and the API calling process and the second information generated by the entire APK file can be automatically obtained, and the first information can be combined with the second information generated by the entire APK file. The second information is reduced to obtain a reduction set, and then the second information and the reduction set are reduced to obtain necessary information required for calling the API interface, and a new APK is generated by using this part of the necessary information. In the new APK, unnecessary information when calling the API interface is deleted, thereby saving storage resources. In addition, due to the deletion of unnecessary information, the occupied volume of the entire APK is smaller, thereby speeding up the APP startup speed.

附图说明Description of drawings

为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the drawings that are used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application. , for those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative labor.

图1是本申请一实施例提出的约减方法的步骤流程图;1 is a flow chart of steps of a reduction method proposed by an embodiment of the present application;

图2是本申请一实施例提出的生成APK文件的步骤流程图;Fig. 2 is a flow chart of the steps of generating an APK file proposed by an embodiment of the present application;

图3是本申请一实施例提出的剔除约减集合的步骤流程图;FIG. 3 is a flow chart of steps for culling a reduction set proposed by an embodiment of the present application;

图4是本申请一实施例提出的具体APK约减过程的示意图;4 is a schematic diagram of a specific APK reduction process proposed by an embodiment of the present application;

图5是本申请一实施例提出的对堆栈信息文件进行解析的步骤流程图;5 is a flowchart of steps for parsing a stack information file proposed by an embodiment of the present application;

图6是本申请一实施例提出的API驱动的Android应用程序约减工具的步骤流程图;6 is a flowchart of steps of an API-driven Android application reduction tool proposed by an embodiment of the present application;

图7是本申请一实施例提出的API驱动的Android应用程序约减工具的流程框图;7 is a flowchart of an API-driven Android application reduction tool proposed by an embodiment of the present application;

图8是本申请一实施例提出的查找缺失的信息的步骤流程图;8 is a flowchart of steps for searching for missing information proposed by an embodiment of the present application;

图9是本申请又一实施例提出的一种场景驱动的应用程序约减系统。FIG. 9 is a scene-driven application program reduction system proposed by another embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

在终端上启动APP,终端上的Android应用程序在调用API接口时,会加载整个APK。而实际上,调用API接口仅需要APK内小部分代码和资源的支持,加载整个APK占用了较大的存储资源,并且也拖慢了APP启动速度。Start the APP on the terminal. When the Android application on the terminal calls the API interface, the entire APK will be loaded. In fact, calling the API interface only requires the support of a small part of the code and resources in the APK. Loading the entire APK takes up a large amount of storage resources, and also slows down the startup speed of the APP.

申请人在进行研究时发现,为了获取API接口所需的APK资源,仅仅只对API接口的调用过程进行研究是远远不够的,这是因为在API调用过程中会涉及到很多全局对象,而这些全局对象的构造与修改不仅在API调用过程之中,也在APP启动过程中,因此加大了分析难度。During the research, the applicant found that in order to obtain the APK resources required by the API interface, it is not enough to only study the calling process of the API interface, because many global objects will be involved in the API calling process, and The construction and modification of these global objects are not only during the API call process, but also during the APP startup process, which increases the difficulty of analysis.

另外,为了在整个APK中,获取API接口所需的APK资源,若使用“保留集合”,即保留API接口所需的APK资源,会使得在API接口调用失败时,无法缺失的信息进行定位。原因在于:若使用“保留集合”作为新的APK,则在进行系统测试时,会查询到API接口调用失败时的缺失信息,并将该缺失信息混合至“保留集合”中,导致无法对缺失的信息进行定位。In addition, in order to obtain the APK resources required by the API interface in the entire APK, if the "reserved set" is used, that is, the APK resources required by the API interface are reserved, which will make it impossible to locate the missing information when the API interface call fails. The reason is: if the "reserved set" is used as the new APK, the missing information when the API interface call fails will be queried during the system test, and the missing information will be mixed into the "reserved set", so that the missing information cannot be detected. information to locate.

为此,本申请实施例提出:获取整个APK文件产生的第二信息,并将APP启动过程和API调用过程产生的堆栈信息进行转化后,形成第一信息,将第一信息与第二信息进行约减,从而得到约减集合,再将第二信息与约减集合进行约减,从而得到调用API接口时所需的必要信息,并利用这部分必要信息生成新的APK。To this end, the embodiment of the present application proposes to obtain the second information generated by the entire APK file, convert the stack information generated by the APP startup process and the API calling process, to form the first information, and compare the first information with the second information. Reduction is performed to obtain a reduction set, and then the second information is reduced with the reduction set to obtain the necessary information required for calling the API interface, and a new APK is generated by using this part of the necessary information.

一方面,本申请不仅考虑到API接口的调用过程产生的信息,也考虑到APP启动过程产生的信息,将二者的信息作为第一信息进行待约减,从而考虑到所有的全局对象;另一方面,本申请采用“约减集合”而非“保留集合”,可以对缺失的信息进行定位,原因在于:若在第二信息中将约减集合剔除后的信息作为新的APK,则在进行系统测试时,程序会对约减集合中缺失的信息进行注释,使得系统在剔除约减集合时,会自动忽略被注释的缺失的信息,则不会将缺失的信息进行剔除,该缺失的信息会被保存至新的APK中,从而保证新的APK的正常运行,由于在约减集合中已经对缺失的信息进行了注释,所以可以对缺失的信息进行定位。On the one hand, this application not only considers the information generated by the calling process of the API interface, but also considers the information generated by the APP startup process, and uses the information of the two as the first information to be reduced, so as to consider all global objects; On the one hand, this application adopts "reduced set" instead of "reserved set", which can locate the missing information. When performing a system test, the program will annotate the missing information in the reduction set, so that the system will automatically ignore the annotated missing information when eliminating the reduction set, and the missing information will not be eliminated. The information will be saved to the new APK to ensure the normal operation of the new APK. Since the missing information has been annotated in the reduction set, the missing information can be located.

参照图1,示出了本申请一实施例提出的约减方法的步骤流程图,具体可以包括如下步骤:Referring to FIG. 1, a flowchart of steps of a reduction method proposed by an embodiment of the present application is shown, which may specifically include the following steps:

步骤S1:获取APP启动过程与API调用过程中的堆栈信息,形成堆栈信息文件,其中,所述堆栈信息文件包括方法参数与返回值。Step S1: Acquire the stack information in the APP startup process and the API calling process, and form a stack information file, wherein the stack information file includes method parameters and return values.

本实施例中,通过运行时堆模型与运行时栈模型,可以获取APP启动过程与API调用过程中的堆栈信息,并对该堆栈信息进行记录,形成堆栈信息文件。In this embodiment, through the runtime heap model and the runtime stack model, the stack information in the APP startup process and the API calling process can be acquired, and the stack information can be recorded to form a stack information file.

其中,运行时堆模型用于反映代码执行过程中的数据流,即数据的创建、修改与回收等过程,是一组内存数据的初始值和在一段时间内发生的堆修改活动的集合;运行时栈模型用于反映代码执行过程中的控制流,即循环、分支、方法调用等过程,是一个或多个控制流在一段时间内发生的活动的集合。Among them, the runtime heap model is used to reflect the data flow in the process of code execution, that is, the process of data creation, modification and recycling. It is a set of initial values of a set of memory data and heap modification activities that occur within a period of time; The time stack model is used to reflect the control flow in the process of code execution, that is, processes such as loops, branches, method calls, etc. It is a collection of activities that occur in one or more control flows over a period of time.

在步骤S1中,是基于动态分析技术和/或静态分析技术,来获取所述APP启动过程与所述API调用过程中的堆栈信息,形成所述堆栈信息文件。In step S1, the stack information in the APP startup process and the API calling process is acquired based on the dynamic analysis technology and/or the static analysis technology, and the stack information file is formed.

其中,在进行本申请中的约减工作时,基于静态分析技术和/或动态分析技术的方法进行来获取堆栈信息,堆栈信息中包括代码、资源与共享库等资源。静态分析技术指的是指在不运行程序方式下,通过语法分析、语义分析、控制流分析、数据流分析等方法对静态代码进行扫描,主要用来进行漏洞检测、电池消耗优化、测试用例生成、权限分析、隐私数据泄露检测等工作。动态分析技术指的是通过运行程序,对程序运行时的状态进行观察,包括寄存器、内存、函数调用情况、堆栈信息等,在应用分析领域,主要用来进行代码覆盖率检测、故障定位、安全分析、并发错误查找、程序切片等工作。Wherein, when performing the reduction work in the present application, the method based on static analysis technology and/or dynamic analysis technology is used to obtain stack information, and the stack information includes resources such as codes, resources and shared libraries. Static analysis technology refers to scanning static code through syntax analysis, semantic analysis, control flow analysis, data flow analysis and other methods without running the program. It is mainly used for vulnerability detection, battery consumption optimization, and test case generation. , permission analysis, privacy data leakage detection, etc. Dynamic analysis technology refers to the observation of the running state of the program by running the program, including registers, memory, function calls, stack information, etc. In the field of application analysis, it is mainly used for code coverage detection, fault location, security Analysis, concurrency bug finding, program slicing, etc.

静态分析技术主要针对安装包体积较大的APP,例如游戏类的APP。使用时,无需启动APP,从API接口出发,对代码、资源与共享库之间的依赖关系进行系统全面的梳理,以确定需要保留的堆栈信息中的代码、资源与共享库。Static analysis technology is mainly aimed at APPs with large installation packages, such as game APPs. When using, there is no need to start the APP, starting from the API interface, systematically and comprehensively sort out the dependencies between the code, resources and shared libraries to determine the code, resources and shared libraries in the stack information that need to be retained.

动态分析技术主要针对安装包体积较小的APP,例如非游戏类的APP,其APP启动时间为秒级,API调用时间为毫秒级。使用时,根据APP启动过程与API调用过程时产生的堆栈信息,直接确定涉及到的代码、资源与共享库,避免了静态分析技术中复杂的依赖关系的梳理与分析。另外,动态分析技术根据代码运行的实际情况,保留真正被执行到的代码部分,对于安装包体积较小的APP来说,可以做到更彻底的约减。The dynamic analysis technology is mainly aimed at APPs with small installation packages, such as non-game APPs. The APP startup time is in seconds, and the API call time is in milliseconds. When using, according to the stack information generated during the APP startup process and the API calling process, the code, resources and shared libraries involved can be directly determined, avoiding the sorting and analysis of complex dependencies in static analysis technology. In addition, the dynamic analysis technology retains the part of the code that is actually executed according to the actual situation of the code running, which can achieve a more thorough reduction for APPs with smaller installation packages.

在步骤S1中,由于APP启动过程与API调用过程会产生大量的堆栈信息,若不加以限制,抓取全部的堆栈信息,抓取堆栈信息的过程会额外占用终端的CPU以及内存资源,加上APP本身运行所需资源,超过了终端的性能上限,导致APP在运行过程中会卡死甚至崩溃。另外,即使经过长时间等待,获取到了全部的堆栈信息,由于其占用内存极大,也难以进行后续步骤S2中的解析。In step S1, since the APP startup process and the API calling process will generate a large amount of stack information, if not restricted, all stack information will be captured, and the process of capturing the stack information will additionally occupy the CPU and memory resources of the terminal. The resources required for the running of the APP itself exceed the performance limit of the terminal, resulting in the APP freezing or even crashing during the running process. In addition, even if all the stack information is obtained after a long wait, it is difficult to perform the analysis in the subsequent step S2 because it occupies a large amount of memory.

为了保证堆栈信息获取的顺利进行,具体通过分阶段、分内容与分类三个方面进行分别获取堆栈信息:In order to ensure the smooth progress of stack information acquisition, the stack information is obtained by stages, content and classification:

A1:将所述Android应用程序的运行阶段分为多个子阶段,通过分子阶段的方式,来获取所述APP启动过程与所述API调用过程中的堆栈信息,其中,所述子阶段至少包括所述APP启动阶段与所述API调用阶段。A1: Divide the running phase of the Android application into multiple sub-phases, and obtain the stack information in the APP startup process and the API calling process by means of molecular phases, wherein the sub-phases at least include all The APP startup phase and the API calling phase.

在A1中,Android应用程序的运行过程至少包括APP启动阶段与API调用阶段。在进行分阶段调取堆栈信息时,可以将APP启动和API调用看成两个过程,对两个过程分别进行堆栈信息的抓取。例如,打开APP后,生成一个堆栈信息文件,再依次调用各个API,生成另一堆栈信息文件。这样两个堆栈信息文件中分别记录了APP启动和API调用两个过程中的堆栈信息,而不用对两个过程中的堆栈信息进行一次性获取,来放入一个堆栈信息文件中。In A1, the running process of an Android application includes at least the APP startup phase and the API calling phase. When invoking stack information in stages, APP startup and API call can be regarded as two processes, and stack information is captured for the two processes respectively. For example, after opening the APP, a stack information file is generated, and then each API is called in turn to generate another stack information file. In this way, the two stack information files respectively record the stack information in the two processes of APP startup and API calling, instead of obtaining the stack information in the two processes at one time and putting them into one stack information file.

另外,针对体积大、启动过程慢、启动加载项多的APP,即使单独抓取启动时的堆栈信息,可能也无法顺利进行。此时,将APP启动过程划分成多个阶段,例如,当用户界面弹出启动动画前为第一个阶段,启动动画运行时为第二个阶段,启动动画结束后为第三个阶段。In addition, for apps with large size, slow startup process, and many startup add-ons, even if the stack information at startup is captured separately, it may not be able to proceed smoothly. At this time, the APP startup process is divided into multiple stages. For example, the first stage is before the user interface pops up the startup animation, the second stage is when the startup animation is running, and the third stage is after the startup animation ends.

A2:将所述Android应用程序产生的信息分为多个子信息,通过分别获取多个子信息的方式,来获取APP启动过程与API调用过程中的堆栈信息,其中,所述堆栈信息包括多个子信息。A2: Divide the information generated by the Android application into multiple sub-information, and obtain the stack information in the APP startup process and the API calling process by separately acquiring multiple sub-information, wherein the stack information includes multiple sub-information .

在A2中,对堆栈信息进行多次抓取,每次抓取其中的不同信息,以减少每个堆栈信息文件的大小。例如,第一次仅仅抓取Android应用程序运行的过程中(包括APP启动过程和API调用过程)使用到的方法、参数和返回值等子信息,第二次抓取方法、字段修改信息、异常等子信息。In A2, the stack information is captured multiple times, and different information is captured each time to reduce the size of each stack information file. For example, for the first time, only sub-information such as methods, parameters, and return values used in the running process of the Android application (including the APP startup process and the API calling process) are captured, and the second time is to capture methods, field modification information, and exceptions. and other sub-information.

A3:将所述Android应用程序产生的信息标注,分为关注类与非关注类,通过关注类或非关注类,来获取所述APP启动过程与所述API调用过程中的堆栈信息。A3: Annotate the information generated by the Android application into a concerned class and a non-concerned class, and obtain the stack information in the APP startup process and the API calling process through the concerned class or the non-concerned class.

在A3中,通过配置关注的堆栈信息与非关注的堆栈信息,实现抓取集合的不断缩减,最终将堆栈信息文件限制在可接受的范围内。例如,通过初步的堆栈信息抓取或人工分析,已经确定了10个堆栈信息会被保留,则下次进行堆栈信息抓取时,可以将这些堆栈信息配置为非关注类,运行时堆模型与运行时栈模型也就不会记录与之相关的调用过程和实例对象,减少了记录的开销。再例如,如果想要确定某一小部分堆栈信息是否会被使用,可以将这部分堆栈信息配置为关注类,由于关注类一般较少,所以可以加速堆栈信息的解析过程。In A3, by configuring the stack information of concern and the stack information of non-concern, the continuous reduction of the grab set is realized, and the stack information file is finally limited to an acceptable range. For example, through preliminary stack information capture or manual analysis, it has been determined that 10 stack information will be retained, then when stack information capture is performed next time, these stack information can be configured as non-concerned classes, and the runtime heap model is the same as The runtime stack model will not record the calling process and instance objects related to it, which reduces the recording overhead. For another example, if you want to determine whether a small part of the stack information will be used, this part of the stack information can be configured as a class of interest. Since there are generally fewer classes of interest, the parsing process of the stack information can be accelerated.

通过以上三个方面对堆栈信息进行分阶段、分内容与分类的方式进行分别获取,通过减小堆栈信息文件的大小,避免了APP在运行过程中会卡死甚至崩溃;通过将堆栈信息分为多个内容且设置为关注类与非关注类,进一步缩减了堆栈信息文件的大小,使得后续步骤S2中对堆栈信息的解析得以实现。Through the above three aspects, the stack information is obtained by stages, content and classification. By reducing the size of the stack information file, the APP is prevented from being stuck or even crashing during the running process; by dividing the stack information into Multiple contents are set as attention classes and non-attention classes, which further reduces the size of the stack information file, so that the analysis of the stack information in the subsequent step S2 can be realized.

步骤S2:对所述堆栈信息文件中的返回值进行解析,得到类列表;对所述堆栈信息文件中的方法参数进行解析,得到资源列表与共享库列表;将所述类列表、所述资源列表与所述共享库列表作为第一信息。Step S2: parse the return value in the stack information file to obtain a class list; parse the method parameters in the stack information file to obtain a resource list and a shared library list; The list and the shared library list are used as the first information.

在步骤S2中,通过运行时堆模型与运行时栈模型来获取堆栈信息文件,堆栈信息文件中至少包括方法、参数与返回值等信息,其中方法、参数与返回值等信息中包括类、资源与共享库等堆栈信息,本步骤着重于将类、资源与共享库从堆栈信息文件中解析出来以形成第一信息,具体通过以下三个方面进行解析,参照图5,图5示出了具体对堆栈信息文件进行解析的步骤流程图:In step S2, the stack information file is obtained through the runtime heap model and the runtime stack model. The stack information file at least includes information such as methods, parameters and return values, wherein the methods, parameters and return values include classes, resources and other information. and shared libraries and other stack information, this step focuses on parsing classes, resources and shared libraries from the stack information file to form the first information, specifically through the following three aspects for parsing, referring to Figure 5, Figure 5 shows the specific The flow chart of the steps to parse the stack information file:

B1:针对类而言,依据返回值进行解析得到类列表。例如,返回值字段是type@address的形式,其中,type表明了返回值的类型,而adress则是对象的内存地址,截取@之前的字段,即可获得返回值的类型。最终,将获取到的所有类型整理成一个类列表。B1: For classes, the class list is obtained by parsing the return value. For example, the return value field is in the form of type@address, where type indicates the type of the return value, and address is the memory address of the object. Intercept the field before @ to get the type of the return value. Finally, organize all the obtained types into a list of classes.

在B1中,若仅仅在类列表中保存类,而删除其它所有的依赖类,Android应用程序是无法正确运行的。这是因为,类间存在着复杂的依赖关系,堆栈记录文件仅仅保留了类间的调用关系,而没有保留其他关系,所以会产生错误。这时必须考虑继承关系和实现关系这两个关系。例如,对于一个类A,假设它继承了祖先类B,实现了接口类C,在程序实际运行时,并不会记录祖先类B和接口类C的信息,但如果将之删除,则Android应用程序会因为找不到祖先类B或者接口类C,导致错误。In B1, if you just save the class in the class list and delete all other dependent classes, the Android application will not work correctly. This is because there are complex dependencies between classes, and the stack record file only retains the calling relationship between classes, but does not retain other relationships, so errors will occur. At this time, the two relationships of inheritance relationship and realization relationship must be considered. For example, for a class A, assuming that it inherits the ancestor class B and implements the interface class C, when the program actually runs, the information of the ancestor class B and the interface class C will not be recorded, but if it is deleted, the Android application The program will cause an error because the ancestor class B or interface class C cannot be found.

为了避免Android应用程序是无法正确运行的,需要根据类列表,从Dex文件中迭代查询其中每一个类的所有祖先类和接口类,将这些祖先类与接口类和每个类对应后也加入类列表,避免程序无法运行。In order to prevent the Android application from running correctly, it is necessary to iteratively query all ancestor classes and interface classes of each class from the Dex file according to the class list, and add the class after corresponding to the interface class and each class. list to prevent the program from failing to run.

B2:针对资源而言,依据方法参数进行解析得到资源列表。B2: For resources, the resource list is obtained by parsing according to the method parameters.

其中,由于运行时堆模型与运行时栈模型仅支持对堆栈信息进行记录,无法直接获得Android应用程序运行时所实际使用的资源列表,故需要对Android应用加载资源的方法进行研究,通过获取加载资源文件的方法中的参数,来得到资源列表。Among them, because the runtime heap model and the runtime stack model only support the recording of stack information, and cannot directly obtain the list of resources actually used by the Android application when it is running, it is necessary to study the method of loading resources in the Android application. The parameters in the method of the resource file to get the resource list.

基于此,在步骤B2中,通过APK中的res目录下的资源、APK中的asset目录下的资源与新增Resources类来获取资源列表。其中,res目录下的资源提供了一系列访问资源的方法,该res目录下的资源文件会被编译,且会生成资源ID;asset目录下的资源没有被Java编译器编译,是用户加入的原生资源,asset目录下的资源提供了对原生资源的读取接口;新增Resources类代替了原本Resources类的部分功能,也提供了获取部分资源的方法。基于上述三个方法中的参数,即可获得资源列表。Based on this, in step B2, the resource list is obtained through the resources in the res directory in the APK, the resources in the asset directory in the APK, and the newly added Resources class. Among them, the resources in the res directory provide a series of methods for accessing resources. The resource files in the res directory will be compiled and resource IDs will be generated; the resources in the asset directory are not compiled by the Java compiler, but are native to the user. Resources, the resources in the asset directory provide an interface for reading native resources; the new Resources class replaces some of the functions of the original Resources class, and also provides methods for obtaining some resources. Based on the parameters in the above three methods, the resource list can be obtained.

在上述res目录下的资源中,由于开发者使用res目录下的某个资源时,一般会使用其ID,而非使用其资源文件名,所以Java编译器会在编译时赋予资源文件名一个id。而终端却只能识别资源文件名,而无法识别其ID。因此,对于res目录下的资源,程序中设置了一个反编译器,通过该反编译器,可以获取资源id和资源文件名称的对应关系,将一系列的ID,转换成实际被使用的资源列表,从而使得终端可以通过反编译器来获得资源列表。其中,资源列表中包括若干资源文件名称。Among the resources in the res directory above, when developers use a resource in the res directory, they generally use its ID instead of the resource file name, so the Java compiler will give the resource file name an id when compiling. . However, the terminal can only identify the resource file name, but cannot identify its ID. Therefore, for the resources in the res directory, a decompiler is set up in the program. Through this decompiler, the corresponding relationship between the resource ID and the resource file name can be obtained, and a series of IDs can be converted into a list of resources that are actually used. , so that the terminal can obtain the resource list through the decompiler. The resource list includes several resource file names.

B3:针对共享库而言,依据方法参数进行解析得到共享库列表。B3: For shared libraries, the shared library list is obtained by parsing according to the method parameters.

其中,共享库与资源列表类似,无法直接通过运行时堆模型与运行时栈模型直接获取,是通过获取加载lib目录下的方法中的参数,来得到共享库列表。Among them, the shared library is similar to the resource list, and cannot be directly obtained through the runtime heap model and the runtime stack model. The shared library list is obtained by obtaining the parameters in the method of loading the lib directory.

通过B1、B2与B3这三个方面获得的第一信息中可能包含重复的信息,因此,在进行步骤S4,即在确定约减集合之前,需要对这三方面获得的信息分别进行去重,以避免信息的重复。The first information obtained through the three aspects of B1, B2 and B3 may contain duplicate information. Therefore, before step S4 is performed, that is, before the reduction set is determined, the information obtained from these three aspects needs to be deduplicated respectively. to avoid duplication of information.

去重方法如下:针对B1方面获得类列表后进行去重,得到非重复的类列表;针对B2方面获得资源列表后进行去重,得到非重复的资源列表;针对B3方面获得共享库列表后进行去重,得到非重复的共享库列表。最后将非重复的类列表、资源列表与共享库列表作为第一信息进行步骤S4中的约减过程。The deduplication method is as follows: Deduplication is performed after obtaining the class list for the B1 aspect to obtain a non-duplicated class list; Deduplication is performed after the resource list is obtained for the B2 side to obtain a non-duplicated resource list; A shared library list is obtained for the B3 aspect and then performed. Remove duplicates to get a list of non-duplicated shared libraries. Finally, the non-duplicated class list, resource list and shared library list are used as the first information to perform the reduction process in step S4.

S3:对APK文件进行分析,获取所述APK文件中的第二信息,其中,所述第二信息包括类、资源与共享库。S3: Analyze the APK file to obtain second information in the APK file, where the second information includes classes, resources and shared libraries.

在步骤S3中,根据APK文件的格式,提取assets和res文件下的所有资源文件列表,lib文件下的所有共享库文件的列表,以及各个Dex文件中的所有类列表,依据类列表、资源列表与共享库列表形成第二信息。具体解析过程已在S2中的B1至B3三个方面进行了相应地解释,在此不再赘述。In step S3, according to the format of the APK file, extract the list of all resource files under the assets and res files, the list of all shared library files under the lib file, and the list of all classes in each Dex file, according to the class list, resource list The second information is formed with the shared library list. The specific parsing process has been explained correspondingly in the three aspects B1 to B3 in S2, and will not be repeated here.

其中,APK文件包括三种状态:编译前、编译后与安装后,考虑到代码的约减,在步骤S3中,采用编译后的APK文件,APK文件中包括代码、资源与共享库。The APK file includes three states: before compilation, after compilation and after installation, considering code reduction, in step S3, a compiled APK file is used, and the APK file includes code, resources and shared libraries.

在步骤S3中,一方面考虑到步骤S1中的堆栈信息中的代码经过了加工工具的混淆与加固,使得与编译前的源代码有所不同。如果对APK文件编译前的源代码进行约减,需要将堆栈信息中混淆加固后的代码重新映射为编译前的源代码,加大了工作量和工作难度。另一方面考虑到在针对安装包体积较小的APP,是基于动态分析技术来进行分析,仅仅会保留实际执行中用到的代码,删除没有执行到的代码。例如,在一个选择语句中,有A和B两条分支,其中A分支用到了类a,而B分支用到了类b。采用动态分析技术后发现,B分支不会被执行,故类b会被删除。如果对编译前的源代码进行删除,则进行编译的时候,Java编译器会因为找不到类b的代码而编译失败。相反,如果对编译后的Dex字节码进行删除,则不会再次经历编译的过程,避免了编译失败这一问题。因此,综上两方面进行考虑,在步骤S3中,采用编译后的APK文件。In step S3, on the one hand, it is considered that the code in the stack information in step S1 is obfuscated and reinforced by the processing tool, so that it is different from the source code before compilation. If the source code before compilation of the APK file is reduced, the obfuscated and reinforced code in the stack information needs to be remapped to the source code before compilation, which increases the workload and difficulty. On the other hand, considering that the APP with a small installation package is analyzed based on dynamic analysis technology, only the code used in the actual execution will be retained, and the code that has not been executed will be deleted. For example, in a select statement, there are two branches A and B, where the A branch uses class a, and the B branch uses class b. After using dynamic analysis technology, it is found that the B branch will not be executed, so the class b will be deleted. If the source code before compilation is deleted, when compiling, the Java compiler will fail to compile because it cannot find the code of class b. On the contrary, if the compiled Dex bytecode is deleted, it will not go through the compilation process again, avoiding the problem of compilation failure. Therefore, considering the above two aspects, in step S3, the compiled APK file is used.

其中,编译后的APK文件通过以下步骤获取,参照图2,图2示出了本申请一实施例提出的生成APK文件的步骤流程图:Wherein, the compiled APK file is obtained through the following steps, and with reference to FIG. 2, FIG. 2 shows a flowchart of the steps of generating an APK file proposed by an embodiment of the present application:

S301:将Android应用程序中的源代码经过Java编译器编译,生成多个class文件。S301: Compile the source code in the Android application through the Java compiler to generate multiple class files.

其中,JAVA编译器的作用是将JAVA源程序编译成中间代码字节码文件;class文件中只包含一个类,包含对于栈的操作指令。Among them, the function of the JAVA compiler is to compile the JAVA source program into an intermediate code bytecode file; the class file contains only one class, including operation instructions for the stack.

S302:将Android应用程序中的资源文件进行编译,生成编译后的资源文件,其中,所述资源文件包括若干资源与共享库。S302: Compile the resource file in the Android application to generate a compiled resource file, wherein the resource file includes several resources and shared libraries.

S303:将多个class文件通过dx工具生成Dex文件,其中,所述Dex文件包括若干类以及与若干类相关的依赖类。S303: Dex files are generated by multiple class files through the dx tool, wherein the Dex files include several classes and dependent classes related to several classes.

其中,dx工具是d8,一种命令行工具,可以支持在应用的代码中使用JAVA8语言功能,可以将class文件转化为Dex文件;Dex文件中,相对于class文件而言,没有对于栈的操作指令,仅仅是对寄存器进行操作,并且包含多个类,其指令集更大,指令更长。Among them, the dx tool is d8, a command-line tool that can support the use of JAVA8 language functions in the application code, and can convert class files into Dex files; in Dex files, compared with class files, there is no stack operation. Instructions, just operate on registers, and contain multiple classes with larger instruction sets and longer instructions.

S304:将所述编译后的资源文件与所述Dex文件进行打包压缩,生成APK文件。S304: package and compress the compiled resource file and the Dex file to generate an APK file.

其中,由于编译后的资源文件中包含资源与共享库,Dex文件包含多个类,将其进行打包压缩后,即可生成编译后的APK文件。Among them, since the compiled resource file contains resources and shared libraries, and the Dex file contains multiple classes, after being packaged and compressed, a compiled APK file can be generated.

在步骤S1至S3中,得到APP启动过程与API调用过程产生的第一信息;与APK文件中的第二信息,在后续S4步骤中,需要对第一信息与第二信息进行约减,其中第一信息与第二信息均包括代码、资源与共享库,在进行约减时,会涉及到约减粒度的问题,本申请将类作为代码的基本单位,将资源文件作为资源的基本单位,将共享库文件作为共享库的基本单位,来进行第一信息与第二信息的约减。In steps S1 to S3, the first information generated by the APP startup process and the API calling process is obtained; and the second information in the APK file, in the subsequent step S4, the first information and the second information need to be reduced, wherein Both the first information and the second information include code, resources and shared libraries. When reducing, the problem of reduction granularity will be involved. In this application, classes are used as the basic unit of code, and resource files are used as the basic unit of resources. The shared library file is used as the basic unit of the shared library to reduce the first information and the second information.

针对代码而言,可以采用代码包、类、方法或语句为基本单位,而本申请进行约减时,采用类作为代码的基本单位,原因在于:如果以代码包为约减的基本单位,将造成大量冗余,违背了本申请约减程序的原则;如果以方法和语句为代码约减的基本单位,则在获取APP启动与API调用过程中产生的堆栈信息时,必须获取完整的方法调用信息和语句执行信息,且在后续步骤S4与步骤S5中APK约减阶段必须对方法和语句的字节码进行精细操作,大大增加了难度;而在Android应用程序采用Java语言,而Java是一门面向对象的语言,类是其基本单位,所以将类作为代码的基本单位,可以更好的适应Android应用程序。For code, a code package, class, method or statement can be used as the basic unit, and when reducing in this application, the class is used as the basic unit of the code. The reason is: if the code package is used as the basic unit of reduction, the Causes a lot of redundancy, which violates the principle of the reduction program in this application; if methods and statements are used as the basic units of code reduction, then when obtaining the stack information generated during the process of APP startup and API calling, the complete method call must be obtained. Information and statement execution information, and in the APK reduction stage in the subsequent steps S4 and S5, the bytecode of the method and statement must be finely manipulated, which greatly increases the difficulty; while the Android application uses the Java language, and Java is a Object-oriented language, class is its basic unit, so using class as the basic unit of code can better adapt to Android applications.

针对资源而言,可以采用资源类型、资源文件与资源文件内容作为基本单位,而本申请在进行约减时,由于资源在被引用时,往往以单个资源文件作为基本单位,故采用单个资源文件作为基本单位。For resources, the resource type, resource file and resource file content can be used as the basic units, and when reducing resources in this application, since a single resource file is often used as the basic unit when a resource is cited, a single resource file is used. as the base unit.

针对共享库而言,可以采用共享库文件或共享库文件内代码作为基本单位。而本申请在进行约减时,由于共享库的加载以单个共享库文件为单位,故采用单个共享库文件作为基本单位。For the shared library, the shared library file or the code in the shared library file can be used as the basic unit. However, in the present application, since the shared library is loaded in a unit of a single shared library file, a single shared library file is used as the basic unit.

步骤S4:将所述APK文件中的第二信息与所述堆栈信息文件中的第一信息进行比对,从所述APK文件中的第二信息剔除出现的第一信息,得到约减集合。Step S4: compare the second information in the APK file with the first information in the stack information file, and remove the first information that appears from the second information in the APK file to obtain a reduction set.

其中,在确定约减集合时,直接将第一信息与第二信息作差集,即可得到最终的约减集合,约减集合是指APP启动过程与API调用过程不需要使用,即没有被使用过的堆栈信息。Among them, when the reduction set is determined, the first information and the second information are directly subtracted to obtain the final reduction set. The reduction set means that the APP startup process and the API calling process do not need to be used, that is, they are not used. Used stack information.

步骤S5:从所述APK文件中的第二信息中剔除所述约减集合,生成新的APK文件。Step S5: remove the reduction set from the second information in the APK file to generate a new APK file.

其中,在生成新的APK时,由于第一信息与第二信息中均包括类、资源与共享库,所以具体通过以下三个步骤生成新的APK,参照图3,图3示出了一实施例提出的剔除约减集合的步骤流程图:Wherein, when generating a new APK, since both the first information and the second information include classes, resources and shared libraries, the new APK is generated through the following three steps, referring to FIG. 3, which shows an implementation The flow chart of the steps for culling and reducing the set proposed in the example:

S501:针对所述资源与所述共享库,删除所述约减集合中出现的所述资源与所述共享库,生成新的资源文件。S501: For the resource and the shared library, delete the resource and the shared library that appear in the reduction set, and generate a new resource file.

其中,资源存储至assets目录中,共享库存储至lib目录中,具体操作时,直接将assets目录下没有被使用过的资源删除;且将lib目录下约减集合中没有被使用过的共享库删除即可。Among them, the resources are stored in the assets directory, and the shared library is stored in the lib directory. During the specific operation, the unused resources in the assets directory are directly deleted; and the unused shared libraries in the collection are reduced from the lib directory. Just delete it.

S502:针对所述类,读取所述Dex文件中的类,删除所述约减集合中的出现的类,生成新的Dex文件。S502: For the class, read the class in the Dex file, delete the appearing class in the reduction set, and generate a new Dex file.

其中,在生成新的Dex文件的过程中,利用Dex2jar工具的jar包读取Dex文件,删除其中无关的类,再重新生成新的Dex文件。Among them, in the process of generating a new Dex file, the jar package of the Dex2jar tool is used to read the Dex file, delete irrelevant classes therein, and then regenerate a new Dex file.

Dex2jar工具指的是用于Dex文件的分析工具,它可以方便地将Dex文件转换为jar文件,以供后续的分析和开发使用,但在步骤S502中目的是修改Dex文件,即删除约减集合中出现的类,所以并不会直接使用Dex2jar工具,而是使用Dex2jar的jar包,利用jar包中现有的对Dex文件进行分析修改的类与方法,进行相关操作。The Dex2jar tool refers to an analysis tool for Dex files, which can easily convert Dex files into jar files for subsequent analysis and development, but the purpose in step S502 is to modify the Dex file, that is, delete the reduction set Therefore, the Dex2jar tool is not used directly, but the Dex2jar jar package is used, and the existing classes and methods for analyzing and modifying the Dex file in the jar package are used to perform related operations.

S503:根据所述新的Dex文件与所述新的资源文件生成所述新的APK文件。S503: Generate the new APK file according to the new Dex file and the new resource file.

参照图4,图4示出了具体APK约减过程的示意图。其中,在生成新的APK文件时,直接删除res、assets、lib目录下的没有被使用过的资源,并删除dex文件下的类重新生成新的Dex文件;另外,在APP启动过程与API调用过程产生的也不止堆栈信息,也包括部分其它文件,例如签名文件、包含资源文件和资源ID的对应关系的文件;对于签名文件需要进行查错修改,更正后重签名再放入APK文件中;对于包含资源文件和资源ID的对应关系的文件,直接进行拷贝保留至新的APK文件中即可。并最终对新的APK文件重新签名和打包,即完成了对APK的约减。Referring to FIG. 4, FIG. 4 shows a schematic diagram of a specific APK reduction process. Among them, when generating a new APK file, directly delete unused resources in the res, assets, and lib directories, and delete the classes under the dex file to regenerate a new Dex file; in addition, during the APP startup process and API calls The process generates not only stack information, but also some other files, such as signature files, files containing the corresponding relationship between resource files and resource IDs; the signature files need to be checked and modified, and then re-signed after correction and put into the APK file; For the file containing the corresponding relationship between the resource file and the resource ID, you can directly copy it and keep it in the new APK file. And finally re-sign and package the new APK file, which completes the APK reduction.

在步骤S503后,即在生成新后的APK文件后,为了使得新的APK文件能够支撑API的正常调用,需要根据新的APK与API原先的代码,生成新的反射类Dex文件,才能支持API的正常调用。After step S503, that is, after the new APK file is generated, in order to enable the new APK file to support the normal calling of the API, it is necessary to generate a new reflection class Dex file according to the new APK and the original code of the API, so as to support the API normal call.

在步骤S501至步骤S503中,由于共享库和资源文件的个数相对类来说比较少,而单个共享库文件和单个资源文件的体积又相对较大,所以按照共享库、资源、类的顺序依次约减APK,可以有效快速减小APK的体积,加快约减速度。In steps S501 to S503, since the number of shared libraries and resource files is relatively small compared to the class, and the volume of a single shared library file and a single resource file is relatively large, the shared library, resource, and class are in the order of Reducing the APK in turn can effectively and quickly reduce the size of the APK and speed up the reduction.

在经过步骤S1至步骤S5,生成新的APK文件后,若要添加新的API,直接在新的APK的基础上,加入新增API依赖的代码、资源、共享库,即可完成APK的重约减。After the new APK file is generated through steps S1 to S5, if you want to add a new API, directly on the basis of the new APK, add the code, resources, and shared libraries that the new API depends on, and then the APK can be rebuilt. Reduce.

通过本申请提供的一种场景驱动的应用程序约减方法,可以自动获取APP启动过程和API调用过程产生的第一信息,与整个APK文件产生的第二信息,将第一信息与第二信息进行约减,从而得到约减集合,再将第二信息与约减集合进行约减,从而得到调用API接口时所需的必要信息,并利用这部分必要信息生成新的APK。在新的APK中,删除了调用API接口时的不必要信息,从而节省了存储资源,另外,由于不必要信息的删除,使得整个APK的占用体积更小,从而加快了APP启动速度。并且,本申请基于“约减集合”的思想,而非“保留集合”的思想,可以在进行新的APK的系统测试时,对缺失的信息进行准确定位。Through the scene-driven application program reduction method provided by the present application, the first information generated by the APP startup process and the API calling process and the second information generated by the entire APK file can be automatically obtained, and the first information and the second information can be automatically obtained. The reduction is performed to obtain a reduction set, and then the second information is reduced with the reduction set to obtain the necessary information required for calling the API interface, and a new APK is generated by using this part of the necessary information. In the new APK, unnecessary information when calling the API interface is deleted, thereby saving storage resources. In addition, due to the deletion of unnecessary information, the occupied volume of the entire APK is smaller, thereby speeding up the APP startup speed. Moreover, the present application is based on the idea of "reduced set" rather than "reserved set", so that missing information can be accurately located when a new APK is systematically tested.

以下将对新的APK的系统测试进行详细描述。The system testing of the new APK will be described in detail below.

在上述过程中,在终端上启动APP后,终端上的Android应用程序在调用API接口时,会加载整个APK,APK是Android安装包。而实际上,调用API接口仅需要APK内小部分代码和资源的支持,加载整个APK占用了较大的存储资源。因此,需要对整个APK进行约减,根据约减后得到的约减集合来得到新的APK,来减少加载APK所占用的存储资源。In the above process, after launching the APP on the terminal, when the Android application on the terminal calls the API interface, the entire APK will be loaded, and the APK is the Android installation package. In fact, calling the API interface only requires the support of a small part of the code and resources in the APK, and loading the entire APK takes up a large amount of storage resources. Therefore, it is necessary to reduce the entire APK, and obtain a new APK according to the reduction set obtained after the reduction, so as to reduce the storage resources occupied by loading the APK.

但申请人在进行研究时发现,根据约减集合得到的新的APK往往无法正常运行,除了分析过程的不精确造成的误差以外,代码执行路径的改变也是一个重要原因,代码执行路径的改变基于以下三个原因:1、网络、机型等外在环境的改变;2、代码中的随机性;3、代码和资源被删除。对于第一方面网络、机型等外在环境的改变,例如,在可以连接网络时,很多App的启动会从网络上下载广告,显示在启动页面,而如果无法连网,则会跳过这一过程。再如,利用不同的手机访问同一版本的“驾考宝典”App,小米手机会显示一段启动的动画,而Nexus手机并不会,这些外在环境的改变均会导致新的APK无法正常运行。对于第二方面代码中的随机性,为了实现特定的功能和完成特定的服务,有时代码中必须要加入一定随机性,这也就导致每次运行代码的执行路径可能会有不同。对于第三方面代码和资源被删除,代码和资源被删除,代码和资源未被约减时,在原有的APK是正常运行的,但新的APK,即约减后的APK并不会保留这些代码和资源,也就无法正确运行。However, during the applicant's research, the applicant found that the new APK obtained according to the reduction set often cannot run normally. In addition to the errors caused by the inaccuracy of the analysis process, the change of the code execution path is also an important reason. The change of the code execution path is based on the The following three reasons: 1. Changes in the external environment such as network and model; 2. Randomness in the code; 3. The code and resources are deleted. For the first aspect of changes in the external environment such as network and model, for example, when you can connect to the Internet, many apps will download advertisements from the Internet when they are launched, and display them on the startup page. If you cannot connect to the Internet, this will be skipped. a process. For another example, using different mobile phones to access the same version of the "Driving Test Collection" App, the Xiaomi mobile phone will display a startup animation, but the Nexus mobile phone will not. These changes in the external environment will cause the new APK to fail to run normally. Regarding the randomness in the code of the second aspect, in order to implement a specific function and complete a specific service, sometimes a certain randomness must be added to the code, which leads to a different execution path each time the code is run. For the third aspect, when the code and resources are deleted, the code and resources are deleted, and the code and resources are not reduced, the original APK is running normally, but the new APK, that is, the reduced APK will not retain these code and resources, it will not work correctly.

为了保证新的APK的正常运行,本申请提出一种Android应用程序约减工具,参照图7,主要负责测试新的APK中,App能否正常启动,各个API能否正确调用。如果不能正常调用,则分析Android日志,找出调用失败原因或缺失的信息,重新调整约减集合,再次进行APK约减。迭代进行上述步骤,直至全部API均调用成功。在这个过程中,代码途径改变后,会产生相应的调用失败原因或缺失的信息,并保存至Android日志中,通过分析Android日志,即可查找出调用失败原因或缺失的信息,根据调用失败原因或缺失的信息再对约减集合进行调整,重新从APK文件中剔除约减集合,得到新的APK,反复迭代测试后,能够得到正常运行的APK。In order to ensure the normal operation of the new APK, the present application proposes an Android application program reduction tool, referring to FIG. 7 , which is mainly responsible for testing whether the App in the new APK can be started normally and whether each API can be called correctly. If it cannot be called normally, analyze the Android log to find out the reason for the call failure or missing information, readjust the reduction set, and perform APK reduction again. Iteratively perform the above steps until all API calls are successful. In this process, after the code path is changed, the corresponding call failure reason or missing information will be generated and saved to the Android log. By analyzing the Android log, the call failure reason or missing information can be found out. According to the call failure reason Or the missing information is adjusted to the reduction set, and the reduction set is removed from the APK file again to obtain a new APK. After repeated iterative testing, a normal running APK can be obtained.

参照图6,示出了本发明的一种Android应用程序约减工具的步骤流程图,具体可以包括如下步骤:Referring to FIG. 6 , a flowchart of steps of an Android application program reduction tool of the present invention is shown, which may specifically include the following steps:

S6:将新的APK与APK对应的Dex文件安装至终端上,生成APP。S6: Install the new APK and the Dex file corresponding to the APK on the terminal to generate an APP.

在步骤S6中,将APK安装在终端上,同时将APK对应的Dex文件放入终端的指定文件夹,从而生成APP。In step S6, the APK is installed on the terminal, and the Dex file corresponding to the APK is placed in a designated folder of the terminal, thereby generating an APP.

其中,Dex文件用于暴露步骤S1中阐述到的API接口,且Dex文件没有对于栈的操作指令,仅仅是对寄存器进行操作,并且Dex文件中中包括若干类。Among them, the Dex file is used to expose the API interface described in step S1, and the Dex file does not have operation instructions for the stack, but only operates on registers, and the Dex file includes several categories.

其中,约减后的APK,即新的APK是通过以下步骤得到的:首先对Android应用程序运行过程产生的堆栈信息与APK文件中的信息进行比对,得到约减集合,再从APK文件中剔除约减集合,形成新的APK文件。通过新的APK文件的体积的减小,使其占用较小的存储资源。其中约减集合为API接口不会使用到的堆栈信息,新的APK文件为API接口需要使用的堆栈信息。Among them, the reduced APK, that is, the new APK is obtained through the following steps: first, compare the stack information generated during the running process of the Android application with the information in the APK file to obtain a reduced set, and then extract the information from the APK file. Eliminate the reduction set to form a new APK file. By reducing the size of the new APK file, it takes up less storage resources. The reduction set is the stack information that the API interface will not use, and the new APK file is the stack information that the API interface needs to use.

S7:启动所述APP,终端检测并加载所述APK对应的Dex文件,以暴露API接口。S7: Start the APP, and the terminal detects and loads the Dex file corresponding to the APK to expose the API interface.

其中,启动APP后,终端会相应调用若干个API接口,但是对于本申请中的约减工具来说,却无法得知是通过哪个API接口实现该功能。以支付宝为例,支付宝中包括滴滴出行、饿了么、电影演出等多个功能,每个功能分别对应一个API接口,当用户点击滴滴出行时,系统会调取与滴滴出行对应的API接口,但约减工具却无法得知具体是通过哪个API接口来实现滴滴出行的功能,相应地,也无法得知API接口调用失败的原因。因此,为了让约减工具得知API接口是否被使用,需要暴露API接口,才能获知API接口调用失败的原因。Among them, after starting the APP, the terminal will call several API interfaces accordingly, but for the reduction tool in this application, it is impossible to know which API interface is used to implement the function. Taking Alipay as an example, Alipay includes multiple functions such as Didi Chuxing, Ele.me, and movie performances. Each function corresponds to an API interface. When a user clicks on Didi Chuxing, the system will retrieve the corresponding data from Didi Chuxing. API interface, but the reduction tool cannot know which API interface is used to realize the function of Didi Chuxing. Accordingly, it cannot know the reason why the API interface call fails. Therefore, in order for the reduction tool to know whether the API interface is used, the API interface needs to be exposed to know the reason why the API interface call fails.

Dex文件是反射类Dex文件。通过Dex文件,API接口运行系统,并读取Dex文件,将Dex文件加载到反射类加载器中,并结合Android系统类与Android安装包,最终向约减工具暴露API接口,使得约减工具能够根据API接口所反馈的信息来得知调用结果。Dex files are reflection class Dex files. Run the system through the Dex file and API interface, read the Dex file, load the Dex file into the reflection class loader, and combine the Android system class with the Android installation package to finally expose the API interface to the reduction tool, so that the reduction tool can The call result is known according to the information fed back by the API interface.

另外,在后续步骤S9中阐述到,启动APP后会产生大量信息,这些信息会保存至Android日志中。为了避免Android日志过多导致的传输缓慢和分析困难的问题,在APP启动前,对终端系统中的Android日志进行清理。In addition, as explained in the subsequent step S9, a large amount of information will be generated after starting the APP, and the information will be saved in the Android log. In order to avoid the problems of slow transmission and difficult analysis caused by too many Android logs, the Android logs in the terminal system should be cleaned up before the APP is started.

S8:调用所述API接口,获取调用结果。S8: Call the API interface to obtain the call result.

其中,调用结果包括正常调用或无法正常调用两种情况,其中调用结果为无法正常调用的情况包括:APK安装失败、API调用失败与API调用结果不正确三种情况。The call result includes two cases: normal call or cannot be called normally, and the case where the call result cannot be called normally includes three cases: APK installation failure, API call failure and incorrect API call result.

S9:根据所述调用结果,判断新的APK能否支持所述API接口的正常调用,若能正常调用,则结束约减工作;若无法正常调用,则分析Android日志,查找缺失的信息,其中,所述Android日志在启动APP后产生,缺失的信息包括类、资源与共享库。S9: According to the invocation result, determine whether the new APK can support the normal invocation of the API interface, and if it can be invoked normally, end the reduction work; if it cannot be invoked normally, analyze the Android log to find the missing information, wherein , the Android log is generated after the APP is started, and the missing information includes classes, resources and shared libraries.

其中,在APP启动时,会产生大量信息,该信息中包括堆栈信息,该堆栈信息包括类、资源与共享库。APP启动时产生的大量信息保存至Android日志中,在新的APK无法正常调用时,分析Android日志查出缺失的信息或调用失败原因,并根据缺失的信息与调用失败原因对约减集合进行重新调整。Among them, when the APP is started, a large amount of information is generated, and the information includes stack information, and the stack information includes classes, resources and shared libraries. A large amount of information generated when the APP starts is stored in the Android log. When the new APK cannot be called normally, analyze the Android log to find out the missing information or the reason for the call failure, and re-reduce the reduction set according to the missing information and the reason for the call failure. Adjustment.

在具体分析Android日志时,基于步骤S8中三种情况进行分析。针对APK安装失败时,通过对Android日志进行分析,可以说明该APK的重签名无效。针对API调用失败时,首先需要对API接口返回的信息进行分析,若API接口返回的信息的错误类型为DeadObject,则说明APP没有正确启动或已经被杀死,无法为API调用过程提供堆栈信息中的全局对象;然后需进一步对Android日志进行分析,找出具体错误的信息,其中具体错误的信息包括类、资源与共享库等信息的缺失。针对API调用结果不正确时,可以说明终端本地数据库的资源被删除,导致对本地数据库的访问出现错误。When analyzing the Android log specifically, the analysis is performed based on the three situations in step S8. When the APK installation fails, it can be shown that the re-signature of the APK is invalid by analyzing the Android log. When the API call fails, you first need to analyze the information returned by the API interface. If the error type of the information returned by the API interface is DeadObject, it means that the APP has not been started correctly or has been killed, and the stack information cannot be provided for the API calling process. The global object of , then need to further analyze the Android log to find out the specific error information, the specific error information includes the lack of information such as classes, resources and shared libraries. If the API call result is incorrect, it can indicate that the resources of the terminal's local database have been deleted, resulting in an error in accessing the local database.

由于在整个终端中,不仅仅只有一个APP的进程正在运行,也可能会有其它APP的进程正在运行,这些APP运行时,均会产生信息并保存至Android日志中,为了从Android日志中查询出目标APP产生的信息。在步骤S9中,分析Android日志,查找缺失的信息,具体包括以下步骤,参照图8,图8示出了查找缺失的信息的步骤流程图:Because in the entire terminal, not only the process of one APP is running, but also the processes of other APPs may be running. When these APPs are running, information will be generated and saved in the Android log. Information generated by the target APP. In step S9, the Android log is analyzed to find missing information, which specifically includes the following steps, with reference to FIG. 8, which shows a flowchart of steps for finding missing information:

S901:对所述Android应用程序中的各个应用包名添加上对应的应用包启动时的进程ID标识;其中,所述Android日志中的各个日志条目与各个进程ID标识之间存在映射关系。S901: To each application package name in the Android application program, add the process ID mark when the corresponding application package is started; wherein, there is a mapping relationship between each log entry in the Android log and each process ID mark.

其中,进程ID标识是进程标识符,一个应用包对应一个进程ID标识,在终端中每打开一个应用程序都会创建一个进程ID标识与其对应。The process ID identifier is a process identifier, an application package corresponds to a process ID identifier, and a process ID identifier is created corresponding to each application program opened in the terminal.

S902:根据所述进程ID标识从所述各个日志条目中筛选出目标日志条目。S902: Screen out the target log entry from the respective log entries according to the process ID.

其中,在步骤S901中阐述到,Android日志中的各个日志条目与若干ID标识均存在映射关系,也就是说,各个应用包可以根据ID标识与日志条目之间的映射关系,查询到应用包产生的信息位于哪个目标日志条目下。Among them, it is stated in step S901 that each log entry in the Android log has a mapping relationship with several ID identifiers, that is, each application package can query the application package generation according to the mapping relationship between the ID identifier and the log entry. under which target log entry the information is located.

S903:在所述目标日志条目下,通过正则表达式,匹配出缺失的信息。S903: Under the target log entry, use a regular expression to match missing information.

其中,目标日志条目下存在多个级别的信息,这些日志信息的格式比较固定,因此通过正则表达式可以定位出缺失的信息,例如,通过正则表达式从目标日志条目下匹配出缺失的类或资源名称。Among them, there are multiple levels of information under the target log entry. The format of these log information is relatively fixed. Therefore, the missing information can be located through regular expressions. For example, the missing classes or Resource Name.

S904:若无法通过正则表达式匹配出缺失的信息,则对约减集合通过二分法进行查找,以确定缺失的信息。S904: If the missing information cannot be matched by the regular expression, search the reduction set by the dichotomy method to determine the missing information.

其中,对于无法由程序定位和分析的缺失的信息,即在没有调用结果,没有任何错误提示信息的情况下。为了实现缺失信息定位的自动化,基于二分法对缺失的信息进行定位。例如,首先对约减集合中前一半的内容进行约减,如果有错误,可将缺失的信息定位在约减集合的前一半;如果没有错误,可将缺失的信息定位在约减集合的后一半。继续二分,直至找到缺失的类或资源。在多次迭代的过程中,可产生一个全局的二分结果,即,如果在相邻两次的迭代过程中,上一个迭代过程已经证明删除前N个类不会发生错误,则下一个迭代过程发生错误时,缺失的信息一定不在前N个类中,以此减少重复的计算。Among them, for the missing information that cannot be located and analyzed by the program, that is, there is no call result and no error message. In order to automate the location of missing information, the missing information is located based on the dichotomy method. For example, first reduce the contents of the first half of the reduction set, if there is an error, you can locate the missing information in the first half of the reduction set; if there is no error, you can locate the missing information after the reduction set half. Continue to dichotomize until the missing class or resource is found. In the process of multiple iterations, a global bisection result can be generated, that is, if in the two adjacent iterations, the previous iteration has proved that deleting the first N classes will not cause errors, then the next iteration When an error occurs, the missing information must not be in the top N classes, thus reducing repeated computations.

另外,为了在进行约减集合的二分之前,需对约减集合进行排序,以保证约减集合的有序性。In addition, in order to sort the reduced set before performing the bisection of the reduced set, to ensure the ordering of the reduced set.

S10:根据所述缺失的信息,调整原约减集合,得到新的约减集合。S10: According to the missing information, adjust the original reduction set to obtain a new reduction set.

其中,步骤S8中阐述到,API无法正常调用包括以下三种情况:APK安装失败、API调用失败与API调用结果不正确。在步骤S9中阐述到,针对APK安装失败,说明该APK的重签名无效;针对API调用失败,判断为APP没有正确启动或者已经被杀死,说明类、资源与共享库的缺失;针对API无法正常调用,说明数据库资源被删除。Wherein, as explained in step S8, the failure to call the API normally includes the following three situations: APK installation failure, API call failure and incorrect API call result. As explained in step S9, for the APK installation failure, it means that the re-signature of the APK is invalid; for the API call failure, it is judged that the APP has not been started correctly or has been killed, indicating the lack of classes, resources and shared libraries; If it is called normally, it means that the database resource is deleted.

因此,针对API无法正常调用产生的原因包括:1、调用失败原因,APK的重签名无效;2、缺失了信息,类、资源与共享库的缺失,数据库资源的缺失。因此,在步骤S10中,具体调整原约减集合包括以下三种情况:Therefore, the reasons why the API cannot be called normally include: 1. The reason for the failure of the call, the re-signature of the APK is invalid; 2. The missing information, the lack of classes, resources and shared libraries, and the lack of database resources. Therefore, in step S10, the specific adjustment of the original reduction set includes the following three cases:

针对APK的重签名无效,需要检查签名过程,调整APK的签名即可。The re-signature of the APK is invalid. You need to check the signature process and adjust the APK's signature.

针对类、资源与共享库的缺失,直接从约减集合中注释对应的类、资源与共享库。For the lack of classes, resources and shared libraries, the corresponding classes, resources and shared libraries are directly annotated from the reduction set.

针对数据库资源被删除,也直接从约减集合中注释除对应的数据库资源。When the database resource is deleted, the corresponding database resource is also directly annotated from the reduction set.

S11:根据所述新的约减集合,重复上述步骤进行测试,直至新的APK能够支持所述API接口正常调用。S11: According to the new reduction set, repeat the above steps to test until the new APK can support the normal calling of the API interface.

其中,具体迭代时,由于APK与Dex文件已经被安装至终端上,所以不必每次迭代时均重新安装APK与Dex文件,直接反复进行步骤S7至步骤S11即可进行迭代测试。Among them, during specific iteration, since the APK and Dex files have been installed on the terminal, it is not necessary to reinstall the APK and Dex files for each iteration, and the iterative test can be performed directly by repeating steps S7 to S11.

在本实施例中,从Android日志中找到缺失的类或资源后,将其从约减集合中删除,重新进行约减。为了方便后续的迭代和开发人员的查看,需要将新的约减集合写入原文件。如果每次迭代后都重新将新的约减集合写入原文件,将造成效率低下,因此,为了避免效率低下的情况发生,本实施例直接在多次迭代结束之后,将最终的新的约减集合写入至原APK文件中。In this embodiment, after the missing class or resource is found from the Android log, it is deleted from the reduction set, and the reduction is performed again. In order to facilitate subsequent iterations and developers' viewing, the new reduction set needs to be written to the original file. If the new reduction set is rewritten into the original file after each iteration, it will cause inefficiency. Therefore, in order to avoid the occurrence of inefficiency, this embodiment directly writes the final new reduction set after multiple iterations. The subtraction set is written to the original APK file.

然而,在多次迭代后,开发人员从新的约减集合中将无法得知缺失的类、资源名称与共享库名称,也就难以进行Android日志的错误分析。因此,为了让开发人员得知缺失的类、资源名称与共享库名称,在步骤S10,根据所述缺失的信息,调整所述原约减集合,得到新的约减集合中,需要在所述原约减集合中注释所述缺失的信息;在更新所述原约减集合时,忽略被注释的所述缺失的信息。However, after many iterations, the developer will not be able to know the missing classes, resource names and shared library names from the new reduced set, making it difficult to perform error analysis of the Android log. Therefore, in order to let the developer know the missing class, resource name and shared library name, in step S10, according to the missing information, adjust the original reduction set to obtain a new reduction set, which needs to be in the The missing information is annotated in the original reduction set; when updating the original reduction set, the annotated missing information is ignored.

其中,注释缺失的信息,例如注释缺失的类、资源或共享库,在将约减集合从APK产生的信息中剔除时,即更新约减集合时,系统会自动保留被注释的缺失的信息,而不会将其与约减集合一起删除,一方面保留了缺失的信息;另一方面由于对缺失的信息进行了注释,所以可以便于开发人员得知缺失的信息。Among them, when annotating missing information, such as annotating missing classes, resources or shared libraries, when the reduction set is removed from the information generated by the APK, that is, when the reduction set is updated, the system will automatically retain the annotated missing information. Instead of deleting it together with the reduction set, on the one hand, the missing information is preserved; on the other hand, because the missing information is annotated, it is convenient for developers to know the missing information.

在本实施例中,还包括repick列表,具体操作时,将repick列表导入终端;将所述repick列表中的信息进行保留,其中repick列表至少包括类、资源与共享库的信息。In this embodiment, a repick list is also included. During the specific operation, the repick list is imported into the terminal; the information in the repick list is retained, wherein the repick list at least includes the information of classes, resources and shared libraries.

其中,repick列表,即是对列表中的代码包、资源文件夹等无条件保留。例如,在对离线应用做约减时,需要保留其本地数据库,以支持应用的离线功能。而一次API的调用过程,只会用到数据库的某一条或某几条数据,所以会将其余数据全部删除。然而,API应当支持对本地数据库中所有数据条目的访问,所以通过在repick列表中添加数据库资源的文件夹路径,可以保留整个数据库资源,以支持应用的离线功能。又如,在约减代码时,如果发现几次迭代过程中缺失的类均属于同一个代码包,可以将该代码包加入repick列表,保留其中全部的内容,以节省约减时间。Among them, the repick list is to unconditionally retain the code packages, resource folders, etc. in the list. For example, when reducing an offline application, its local database needs to be preserved to support the offline function of the application. In one API call process, only one or several pieces of data in the database will be used, so all other data will be deleted. However, the API should support access to all data items in the local database, so by adding the folder path of the database resource in the repick list, the entire database resource can be preserved to support the offline functionality of the application. For another example, when reducing code, if it is found that the missing classes in several iterations belong to the same code package, the code package can be added to the repick list, and all the contents in it can be retained to save reduction time.

通过本申请API驱动的Android应用程序约减工具,在代码途径改变后,会产生相应的调用失败原因或缺失的信息,并保存至Android日志中,通过分析Android日志,即可查找出调用失败原因或缺失的信息,根据调用失败原因或缺失的信息再对约减集合进行调整,重新从APK文件中剔除约减集合,得到新的APK,反复迭代测试后,能够得到正常运行的APK。Through the API-driven Android application reduction tool of this application, after the code path is changed, the corresponding call failure reason or missing information will be generated and saved in the Android log. By analyzing the Android log, the cause of the call failure can be found out. Or missing information, adjust the reduction set according to the reason for the failure of the call or the missing information, and remove the reduction set from the APK file again to obtain a new APK. After repeated iterative testing, a normal running APK can be obtained.

实施例二Embodiment 2

参照图9,一种场景驱动的应用程序约减系统,包括:Referring to Figure 9, a scene-driven application reduction system includes:

堆栈信息获取模块,获取APP启动过程与API调用过程中的堆栈信息,形成堆栈信息文件,其中,所述堆栈信息文件包括方法参数与返回值;The stack information acquisition module acquires the stack information in the APP startup process and the API calling process, and forms a stack information file, wherein the stack information file includes method parameters and return values;

堆栈信息解析模块,对所述堆栈信息文件中的返回值进行解析,得到类列表;对所述堆栈信息文件中的方法参数进行解析,得到资源列表与共享库列表;将所述类列表、所述资源列表与所述共享库列表作为第一信息;The stack information parsing module parses the return value in the stack information file to obtain a class list; parses the method parameters in the stack information file to obtain a resource list and a shared library list; The resource list and the shared library list are used as the first information;

APK文件解析模块,对APK文件进行分析,获取所述APK文件中的第二信息,其中,所述第二信息包括类、资源与共享库;an APK file parsing module, analyzes the APK file, and obtains second information in the APK file, wherein the second information includes classes, resources and shared libraries;

约减集合生成模块,将所述APK文件中的第二信息与所述堆栈信息文件中的第一信息进行比对,从所述APK文件中的第二信息剔除出现的第一信息,得到约减集合;The reduction set generation module compares the second information in the APK file with the first information in the stack information file, removes the first information that appears from the second information in the APK file, and obtains approximately minus set;

APK文件生成模块,从所述APK文件中的第二信息中剔除所述约减集合,生成新的APK文件。An APK file generation module, which removes the reduction set from the second information in the APK file, and generates a new APK file.

本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments may be referred to each other.

本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the embodiments of the present application may be provided as methods, apparatuses, or computer program products. Accordingly, the embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The embodiments of the present application are described with reference to the flowcharts and/or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal equipment to produce a machine that causes the instructions to be executed by the processor of the computer or other programmable data processing terminal equipment Means are created for implementing the functions specified in the flow or flows of the flowcharts and/or the blocks or blocks of the block diagrams.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal equipment to operate in a particular manner, such that the instructions stored in the computer readable memory result in an article of manufacture comprising instruction means, the The instruction means implement the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing terminal equipment, so that a series of operational steps are performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby executing on the computer or other programmable terminal equipment The instructions executed on the above provide steps for implementing the functions specified in the flowchart or blocks and/or the block or blocks of the block diagrams.

尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。Although the preferred embodiments of the embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once the basic inventive concepts are known. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications that fall within the scope of the embodiments of the present application.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should also be noted that in this document, relational terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply these entities or there is any such actual relationship or sequence between operations. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion such that a process, method, article or terminal device that includes a list of elements includes not only those elements, but also a non-exclusive list of elements. other elements, or also include elements inherent to such a process, method, article or terminal equipment. Without further limitation, an element defined by the phrase "comprises a..." does not preclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.

以上对本申请所提供的一种场景驱动的应用程序约减方法和系统,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。A scenario-driven application program reduction method and system provided by the present application has been described in detail above. The principles and implementations of the present application are described with specific examples in this paper. The descriptions of the above embodiments are only used for Help to understand the method of the present application and its core idea; meanwhile, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation and application scope. In summary, the content of this specification It should not be construed as a limitation of this application.

Claims (10)

1.一种场景驱动的应用程序约减方法,其特征在于,所述方法包括:1. A scenario-driven application program reduction method, wherein the method comprises: 获取APP启动过程与API调用过程中的堆栈信息,形成堆栈信息文件,其中,所述堆栈信息文件包括方法参数与返回值;Acquire the stack information in the APP startup process and the API calling process, and form a stack information file, wherein the stack information file includes method parameters and return values; 对所述堆栈信息文件中的返回值进行解析,得到类列表;对所述堆栈信息文件中的方法参数进行解析,得到资源列表与共享库列表;将所述类列表、所述资源列表与所述共享库列表作为第一信息;The return value in the stack information file is parsed to obtain a class list; the method parameters in the stack information file are parsed to obtain a resource list and a shared library list; the class list, the resource list and all The shared library list is used as the first information; 对APK文件进行分析,获取所述APK文件中的第二信息,其中,所述第二信息包括类、资源与共享库;The APK file is analyzed to obtain second information in the APK file, wherein the second information includes classes, resources and shared libraries; 将所述APK文件中的第二信息与所述堆栈信息文件中的第一信息进行比对,从所述APK文件中的第二信息剔除出现的第一信息,得到约减集合;The second information in the APK file is compared with the first information in the stack information file, and the first information that appears is removed from the second information in the APK file to obtain a reduction set; 从所述APK文件中的第二信息中剔除所述约减集合,生成新的APK文件。The reduction set is eliminated from the second information in the APK file to generate a new APK file. 2.根据权利要求1所述的方法,其特征在于,获取APP启动过程与API调用过程中的堆栈信息,形成堆栈信息文件,具体包括:2. The method according to claim 1, wherein the stack information in the APP startup process and the API calling process is obtained to form a stack information file, specifically comprising: 基于动态分析技术和/或静态分析技术,将所述Android应用程序的运行阶段分为多个子阶段,通过分子阶段的方式,来获取所述APP启动过程与所述API调用过程中的堆栈信息,其中,所述子阶段至少包括所述APP启动阶段与所述API调用阶段;Based on dynamic analysis technology and/or static analysis technology, the running stage of the Android application is divided into multiple sub-stages, and the stack information in the APP startup process and the API calling process is obtained by means of molecular stages, Wherein, the sub-stage includes at least the APP startup stage and the API calling stage; 基于动态分析技术和/或静态分析技术,将所述Android应用程序产生的信息分为多个子信息,通过分别获取多个子信息的方式,来获取所述APP启动过程与所述API调用过程中的堆栈信息,其中,所述堆栈信息包括多个子信息;Based on dynamic analysis technology and/or static analysis technology, the information generated by the Android application is divided into multiple sub-information, and the information between the APP startup process and the API calling process is obtained by separately acquiring multiple sub-information. stack information, wherein the stack information includes multiple sub-information; 基于动态分析技术和/或静态分析技术,将所述Android应用程序产生的信息标注,分为关注类与非关注类,通过关注类或非关注类,来获取所述APP启动过程与所述API调用过程中的堆栈信息。Based on the dynamic analysis technology and/or the static analysis technology, the information generated by the Android application is marked into a concern class and a non-concerned class, and the APP startup process and the API are obtained through the concerned class or the non-concerned class. Stack information during the calling process. 3.根据权利要求1所述的方法,其特征在于,所述APK文件通过以下步骤获取:3. method according to claim 1, is characterized in that, described APK file obtains by following steps: 将Android应用程序中的源代码经过Java编译器编译,生成多个class文件;The source code in the Android application is compiled by the Java compiler to generate multiple class files; 将Android应用程序中的资源文件进行编译,生成编译后的资源文件,其中,所述资源文件包括若干资源与共享库;Compile the resource file in the Android application to generate a compiled resource file, wherein the resource file includes several resources and a shared library; 将多个class文件通过dx工具生成Dex文件,其中,所述Dex文件包括若干类以及与若干类相关的依赖类;Dex files are generated by multiple class files through the dx tool, wherein the Dex files include several classes and dependent classes related to several classes; 将所述编译后的资源文件与所述Dex文件进行打包压缩,生成APK文件。The compiled resource file and the Dex file are packaged and compressed to generate an APK file. 4.根据权利要求3所述的方法,其特征在于,还包括:4. The method of claim 3, further comprising: 根据所述类列表中的每个类,在Dex文件中查询与每个类相关的依赖类;According to each class in the class list, query the dependent class related to each class in the Dex file; 将所述每个类相关的依赖类与每个类对应,保存至所述类列表中。The dependent classes related to each class are corresponding to each class, and stored in the class list. 5.根据权利要求1所述的方法,其特征在于,从所述APK文件中的第二信息中剔除约减集合,生成新的APK文件,具体包括:5. The method according to claim 1, characterized in that, from the second information in the APK file, the reduction set is removed to generate a new APK file, specifically comprising: 针对所述资源与所述共享库,删除所述约减集合中出现的所述资源与所述共享库,生成新的资源文件;For the resource and the shared library, delete the resource and the shared library that appear in the reduction set, and generate a new resource file; 针对所述类,读取所述Dex文件中的类,删除所述约减集合中的出现的类,生成新的Dex文件;For the class, read the class in the Dex file, delete the class that appears in the reduction set, and generate a new Dex file; 根据所述新的Dex文件与所述新的资源文件生成所述新的APK文件。The new APK file is generated according to the new Dex file and the new resource file. 6.根据权利要求3所述的方法,其特征在于,还包括:6. The method of claim 3, further comprising: 将新的APK与APK对应的Dex文件安装至终端上,生成APP;Install the new APK and the Dex file corresponding to the APK on the terminal to generate an APP; 启动所述APP,终端检测并加载所述APK对应的Dex文件,以暴露API接口;Start the APP, and the terminal detects and loads the Dex file corresponding to the APK to expose the API interface; 调用所述API接口,获取调用结果;Call the API interface to obtain the call result; 根据所述调用结果,判断新的APK能否支持所述API接口的正常调用,若能正常调用,则结束约减工作;若无法正常调用,则分析Android日志,查找缺失的信息,其中,所述Android日志在启动APP后产生,缺失的信息包括类、资源与共享库;According to the call result, it is judged whether the new APK can support the normal call of the API interface. If it can be called normally, the reduction work is ended; if it cannot be called normally, the Android log is analyzed to find the missing information. The Android log described above is generated after launching the APP, and the missing information includes classes, resources and shared libraries; 根据所述缺失的信息,调整所述原约减集合,得到新的约减集合;According to the missing information, adjust the original reduction set to obtain a new reduction set; 根据所述新的约减集合,重复上述步骤进行测试,直至新的APK能够支持所述API接口正常调用。According to the new reduction set, the above steps are repeated for testing until the new APK can support the normal invocation of the API interface. 7.根据权利要求6所述的方法,其特征在于,根据所述缺失的信息,调整所述原约减集合,得到新的约减集合,还包括:7. The method according to claim 6, wherein, according to the missing information, adjusting the original reduction set to obtain a new reduction set, further comprising: 在所述原约减集合中注释所述缺失的信息;annotating the missing information in the original reduction set; 在更新所述原约减集合时,忽略被注释的所述缺失的信息。When updating the original reduction set, the missing information that is annotated is ignored. 8.根据权利要求7所述的方法,其特征在于,分析Android日志,查找缺失的信息,具体包括:8. method according to claim 7, is characterized in that, analyzes Android log, searches for missing information, specifically comprises: 对所述Android应用程序中的各个应用包名添加上对应的应用包启动时的进程ID标识;其中,所述Android日志中的各个日志条目与各个进程ID标识之间存在映射关系;Each application package name in the Android application program is added with the process ID mark when the corresponding application package is started; wherein, there is a mapping relationship between each log entry in the Android log and each process ID mark; 根据所述进程ID标识从所述各个日志条目中筛选出目标日志条目;Filter out the target log entry from the respective log entries according to the process ID identifier; 根据所述目标日志条目,从所述约减集合中匹配出所述缺失的信息,包括:According to the target log entry, the missing information is matched from the reduced set, including: 根据所述目标日志条目,从约减集合中匹配出缺失的信息,具体包括:According to the target log entry, the missing information is matched from the reduction set, which specifically includes: 在所述目标日志条目下,通过正则表达式,匹配出缺失的信息;Under the target log entry, the missing information is matched through a regular expression; 若无法通过正则表达式匹配出缺失的信息,则对约减集合通过二分法进行查找,以确定缺失的信息。If the missing information cannot be matched by the regular expression, the reduction set is searched by the binary method to determine the missing information. 9.根据权利要求6所述的方法,其特征在于,将repick列表导入终端;9. The method according to claim 6, wherein the repick list is imported into the terminal; 将所述repick列表中的信息进行保留,其中repick列表至少包括类、资源与共享库的信息。The information in the repick list is retained, wherein the repick list at least includes information of classes, resources and shared libraries. 10.一种场景驱动的应用程序约减系统,其特征在于,包括:10. A scenario-driven application program reduction system, comprising: 堆栈信息获取模块,获取APP启动过程与API调用过程中的堆栈信息,形成堆栈信息文件,其中,所述堆栈信息文件包括方法参数与返回值;The stack information acquisition module acquires the stack information in the APP startup process and the API calling process, and forms a stack information file, wherein the stack information file includes method parameters and return values; 堆栈信息解析模块,对所述堆栈信息文件中的返回值进行解析,得到类列表;对所述堆栈信息文件中的方法参数进行解析,得到资源列表与共享库列表;将所述类列表、所述资源列表与所述共享库列表作为第一信息;The stack information parsing module parses the return value in the stack information file to obtain a class list; parses the method parameters in the stack information file to obtain a resource list and a shared library list; The resource list and the shared library list are used as the first information; APK文件解析模块,对APK文件进行分析,获取所述APK文件中的第二信息,其中,所述第二信息包括类、资源与共享库;an APK file parsing module, analyzes the APK file, and obtains second information in the APK file, wherein the second information includes classes, resources and shared libraries; 约减集合生成模块,将所述APK文件中的第二信息与所述堆栈信息文件中的第一信息进行比对,从所述APK文件中的第二信息剔除出现的第一信息,得到约减集合;The reduction set generation module compares the second information in the APK file with the first information in the stack information file, removes the first information that appears from the second information in the APK file, and obtains approximately minus set; APK文件生成模块,从所述APK文件中的第二信息中剔除所述约减集合,生成新的APK文件。An APK file generation module, which removes the reduction set from the second information in the APK file, and generates a new APK file.
CN202010809489.2A 2020-08-12 2020-08-12 Scenario-driven application reduction method and system Active CN112099880B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010809489.2A CN112099880B (en) 2020-08-12 2020-08-12 Scenario-driven application reduction method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010809489.2A CN112099880B (en) 2020-08-12 2020-08-12 Scenario-driven application reduction method and system

Publications (2)

Publication Number Publication Date
CN112099880A true CN112099880A (en) 2020-12-18
CN112099880B CN112099880B (en) 2021-07-30

Family

ID=73753649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010809489.2A Active CN112099880B (en) 2020-08-12 2020-08-12 Scenario-driven application reduction method and system

Country Status (1)

Country Link
CN (1) CN112099880B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328266A (en) * 2020-11-06 2021-02-05 北京因特睿软件有限公司 Software interconnection interface-oriented application program reduction method and system
CN114064012A (en) * 2022-01-18 2022-02-18 北京汇元网科技股份有限公司 Dynamic and static combined interface code generation method and system and electronic equipment
CN117454817A (en) * 2023-12-25 2024-01-26 芯能量集成电路(上海)有限公司 Engineering processing method and device based on FPGA, electronic equipment and storage medium
CN117950682A (en) * 2024-01-23 2024-04-30 北京视游互动科技有限公司 UI interface resource management method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103123607A (en) * 2013-03-08 2013-05-29 扬州大学 Software regression testing method based on formal conceptual analysis
CN103268235A (en) * 2013-04-23 2013-08-28 青岛海信宽带多媒体技术有限公司 Intelligent installation method of application programs of network set-top box based on Android platform
CN103473346A (en) * 2013-09-24 2013-12-25 北京大学 Android re-packed application detection method based on application programming interface
CN105574000A (en) * 2014-10-08 2016-05-11 中兴通讯股份有限公司 Method and device for extending APK file application
US20170344350A1 (en) * 2016-05-27 2017-11-30 Oracle International Corporation Triage self-repair for statically compiled executables
CN111258587A (en) * 2020-01-17 2020-06-09 苏宁云计算有限公司 Method, device, equipment and storage medium for realizing android application plug-in

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103123607A (en) * 2013-03-08 2013-05-29 扬州大学 Software regression testing method based on formal conceptual analysis
CN103268235A (en) * 2013-04-23 2013-08-28 青岛海信宽带多媒体技术有限公司 Intelligent installation method of application programs of network set-top box based on Android platform
CN103473346A (en) * 2013-09-24 2013-12-25 北京大学 Android re-packed application detection method based on application programming interface
CN105574000A (en) * 2014-10-08 2016-05-11 中兴通讯股份有限公司 Method and device for extending APK file application
US20170344350A1 (en) * 2016-05-27 2017-11-30 Oracle International Corporation Triage self-repair for statically compiled executables
CN111258587A (en) * 2020-01-17 2020-06-09 苏宁云计算有限公司 Method, device, equipment and storage medium for realizing android application plug-in

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
姜淑娟: "空指针异常的自动故障定位方法", 《通信学报》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328266A (en) * 2020-11-06 2021-02-05 北京因特睿软件有限公司 Software interconnection interface-oriented application program reduction method and system
CN112328266B (en) * 2020-11-06 2021-09-28 因特睿科技有限公司 Software interconnection interface-oriented application program reduction method and system
CN114064012A (en) * 2022-01-18 2022-02-18 北京汇元网科技股份有限公司 Dynamic and static combined interface code generation method and system and electronic equipment
CN114064012B (en) * 2022-01-18 2022-03-29 北京汇元网科技股份有限公司 Dynamic and static combined interface code generation method and system and electronic equipment
CN117454817A (en) * 2023-12-25 2024-01-26 芯能量集成电路(上海)有限公司 Engineering processing method and device based on FPGA, electronic equipment and storage medium
CN117454817B (en) * 2023-12-25 2024-04-12 芯能量集成电路(上海)有限公司 Engineering processing method and device based on FPGA, electronic equipment and storage medium
CN117950682A (en) * 2024-01-23 2024-04-30 北京视游互动科技有限公司 UI interface resource management method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN112099880B (en) 2021-07-30

Similar Documents

Publication Publication Date Title
US10846083B2 (en) Semantic-aware and self-corrective re-architecting system
CN110321275B (en) Program monitoring method, device, computing equipment and storage medium
US8930884B2 (en) Efficient extraction of software dependencies from program code
US8707263B2 (en) Using a DSL for calling APIS to test software
US8316448B2 (en) Automatic filter generation and generalization
KR101944570B1 (en) Transformational context-aware data source management
CN112099880A (en) Scenario-driven application reduction method and system
US9104797B1 (en) Efficient cloud-based annotation of crash reports
US10922213B2 (en) Embedded quality indication data for version control systems
US10203953B2 (en) Identification of duplicate function implementations
CN109284222B (en) Software unit, project testing method, device and equipment in data processing system
Azim et al. Dynamic slicing for android
CN111352631B (en) Interface compatibility detection method and device
CN112445706A (en) Program abnormal code acquisition method and device, electronic equipment and storage medium
US20190205105A1 (en) Automatically building software projects
CN106354624A (en) Automatic testing method and device
US20120222023A1 (en) Automatic runtime dependency lookup
CN117493169A (en) A method, device, equipment and medium for detecting API behavior incompatibility between Java dependency library versions
US11256602B2 (en) Source code file retrieval
Borodin et al. Deterministic static analysis
CN119376741B (en) Java migration compatibility processing method, device and storage medium
CN117931608B (en) Method and device for counting file cache occupation in vmcore and storage medium
CN112328266B (en) Software interconnection interface-oriented application program reduction method and system
Williams The Embedding and Retrieval of Software Supply Chain Information in Java Applications
JP2017207882A (en) Analyzer and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant