CN105574000A - Method and device for expanding APK (Android Package) file application - Google Patents

Method and device for expanding APK (Android Package) file application Download PDF

Info

Publication number
CN105574000A
CN105574000A CN201410529570.XA CN201410529570A CN105574000A CN 105574000 A CN105574000 A CN 105574000A CN 201410529570 A CN201410529570 A CN 201410529570A CN 105574000 A CN105574000 A CN 105574000A
Authority
CN
China
Prior art keywords
file
apk
xml
initial
type
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
CN201410529570.XA
Other languages
Chinese (zh)
Other versions
CN105574000B (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201410529570.XA priority Critical patent/CN105574000B/en
Priority to PCT/CN2015/071471 priority patent/WO2016054880A1/en
Priority to PCT/CN2015/074404 priority patent/WO2015154612A1/en
Publication of CN105574000A publication Critical patent/CN105574000A/en
Application granted granted Critical
Publication of CN105574000B publication Critical patent/CN105574000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/445Program loading or initiating

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method for expanding an APK (Android Package) file application. The method for expanding the APK file application comprises the following steps: obtaining an initial APP file and a shell file; carrying out decompilation processing on the initial APK file; extracting a target file which has the same file type with the shell file from the file subjected to the decompilation processing; carrying out combination processing on the target file and the shell file; and storing the file subjected to the combination processing and the initial APK file to a preset folder, and packaging and constructing the preset folder into a target APK file. The invention also discloses a device for expanding the APK file application. The initial APK file is decompiled, the shell file and the decompiled file are processed, and new functions can be flexibly and conveniently added to traditional mobile applications on a premise that the source code of the initial APK file does not need to be changed and the file structure of dex does not need to be revised.

Description

The method of expansion APK file application and device
Technical field
The present invention relates to APK file field, particularly relate to a kind of method and the device of expanding APK file application.
Background technology
Along with the development of society, enterprise mobile application is developed fast, but owing to not having the planning of seeking unity of standard at the beginning of enterprise mobile application development, makes a lot of enterprise mobile application function incomplete, becomes the isolated Mobile solution left over.The developer relevant due to Mobile solution has been difficult to find, and code maintenance is also little, making to increase some function by remodifying source code, becoming very difficult, can bring high cost of development simultaneously to enterprise.Android is as emerging platform, and APK file structure is different from executable file, and what also do not occur standard adds shell solution shell instrument.The full name adding shell is the compression of executable program resource, and the executable program that this concept source is held in PC is implant one section of code in binary program, preferentially obtains the control of program, doing some extra works when running.It is adopt the mode merging dex file to carry out that the APK spread on the net now adds shell side formula, by separating shell dex Piece file mergence at the head of former dex file or afterbody, then revises item relevant in dex file header.The shell side formula that adds so is also carry out for the encryption of dex file own, can not increase the ability of original APK itself, and need the file structure revising dex, add shell side formula complicated.The customization that existing technology is difficult to make enterprise flexible and transform original enterprise mobile application.
Foregoing, only for auxiliary understanding technical scheme of the present invention, does not represent and admits that foregoing is prior art.
Summary of the invention
Fundamental purpose of the present invention is to solve the technical matters existing Mobile solution being added to shell difficulty.
For achieving the above object, a kind of method expanding APK file application provided by the invention, the method for described expansion APK file application comprises the following steps:
Obtain initial APK file and shelf document;
Decompiling process is carried out to described initial APK file;
The file destination identical with the file type of described shelf document is extracted from the file after decompiling process;
Described file destination and described shelf document are carried out merging treatment;
File after merging treatment and described initial APK file storage are pressed from both sides to profile, and the described profile folder of packing structure is target APK file.
Preferably, described file destination comprises an xml file and first resource file, and described shelf document comprises the 2nd xml file and Secondary resource file;
Describedly merging treatment carried out to described file destination and described shelf document comprise:
Resolve a described xml file and described 2nd xml file;
The content that a described xml file is identical with described 2nd xml file interior joint type merges, and is merged by the file that described first resource file is identical with the file type of son file in described Secondary resource file;
File storage after merging treatment is comprised to profile folder:
The content that a described xml file is identical with described 2nd xml file interior joint type is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile;
The file that described first resource file is identical with the file type of son file in described Secondary resource file is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile.
Preferably, described by the file after merging treatment and the storage of described initial APK file to profile folder, and packing also comprises before building the step that described profile folder is target APK file:
Preset label information is added in the xml file that described profile presss from both sides.
Preferably, described initial APK file is carried out to the step of decompiling process after also comprise:
Obtain the file type of described initial APK file, judge whether the type of described APK file is APK type;
If the type of described initial APK file is APK type, obtain the xml file of described initial APK file, judge whether there is preset label information in described xml file;
When there is not preset label information in described xml file, perform the described file destination that extraction is identical with the file type of described shelf document from the file after decompiling process.
Preferably, described by the file after merging treatment and the storage of described initial APK file to profile folder, and packing also comprises before building the step that described profile folder is target APK file:
The filename that described profile presss from both sides is revised as consistent with the filename of described initial APK file.
In addition, for achieving the above object, the present invention also provides a kind of device expanding APK file application, and the device of described expansion APK file application comprises:
Acquisition module, for obtaining initial APK file and shelf document;
Decompiling module, for carrying out decompiling process to described initial APK file;
Extraction module, for extracting the file destination identical with the file type of described shelf document from the file after decompiling process;
Merge module, for described file destination and described shelf document are carried out merging treatment;
Pack and build module: for the file after merging treatment and described initial APK file storage being pressed from both sides to profile, and the described profile folder of packing structure is target APK file.
Preferably, described merging module comprises:
Resolution unit, for resolving a described xml file and described 2nd xml file;
Merge cells, merges for the content that a described xml file is identical with described 2nd xml file interior joint type, and is merged by the file that described first resource file is identical with the file type of son file in described Secondary resource file;
Described packing builds module and carries out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile specifically for the content that a described xml file is identical with described 2nd xml file interior joint type;
The file that described first resource file is identical with the file type of son file in described Secondary resource file is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile.
Preferably, the device of described expansion APK file application also comprises:
Mark module, adds preset label information in the xml file that presss from both sides at described profile.
Preferably, the device of described expansion APK file application also comprises:
First judge module, for obtaining the file type of described initial APK file, judges whether the type of described APK file is APK type;
Second judge module, if be APK type for the type of described initial APK file, obtains the xml file of described initial APK file, judges whether there is preset label information in described xml file;
Described second judge module also for, when there is not preset label information in described xml file, extraction module extracts the file destination identical with the file type of described shelf document from the file after decompiling process.
Preferably, it is characterized in that, the device of described expansion APK file application also comprises:
Replacement module, the filename for being pressed from both sides by described profile is revised as consistent with the filename of described initial APK file.
The present embodiment obtains an xml file and first resource file by first carrying out decompiling to initial APK file, then the process such as merging are carried out to the 2nd xml file of an xml file and shell to be added, first resource file and Secondary resource file are carried out to the process such as merging and the file after process is stored into profile folder, finally profile is pressed from both sides packing and be built into target APK file, to realize the object function of shell to be added be attached in initial APK file, do not need the source code changing initial APK file in the process, the file structure revising dex is not needed yet, flexible when making to increase new function to existing Mobile solution, simple, be conducive to the more simple and efficient customization of enterprise and transform original enterprise mobile application.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet that the present invention expands method first embodiment of APK file application;
Fig. 2 is the schematic flow sheet that the present invention expands method second embodiment of APK file application;
Fig. 3 is the schematic flow sheet that the present invention expands method the 3rd embodiment of APK file application;
Fig. 4 is the schematic flow sheet that the present invention expands method the 4th embodiment of APK file application;
Fig. 5 is the schematic flow sheet that the present invention expands method the 5th embodiment of APK file application;
Fig. 6 is the high-level schematic functional block diagram that the present invention expands device first embodiment of APK file application;
Fig. 7 is the high-level schematic functional block diagram that the present invention expands device second embodiment of APK file application;
Fig. 8 is the high-level schematic functional block diagram that the present invention expands device the 3rd embodiment of APK file application;
Fig. 9 is the high-level schematic functional block diagram that the present invention expands device the 4th embodiment of APK file application;
Figure 10 is the high-level schematic functional block diagram that the present invention expands device the 5th embodiment of APK file application.
The realization of the object of the invention, functional characteristics and advantage will in conjunction with the embodiments, are described further with reference to accompanying drawing.
Embodiment
Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
The invention provides a kind of method expanding APK file application, see figures.1.and.2, Fig. 1 is the schematic flow sheet that the present invention expands method first embodiment of APK file application; Fig. 2 is the schematic flow sheet that the present invention expands method second embodiment of APK file application.
The present invention be by give existing initial APK file, add the shell of pre-expansion function, realize the function expanding initial APK file, the concrete steps of method are as follows, and wherein APK file is the executable file under android system.
In one embodiment, the method expanding APK file application comprises the following steps:
S10: obtain initial APK file and shelf document;
Receive the initial APK file that user prepares to add shell, receive the instruction that user selects shelf document, according to the selection instruction of user, from shelf document storehouse, extract required shelf document.
S20: decompiling is carried out to initial APK file;
S30: extract the file destination identical with the file type of shelf document from the file after decompiling process;
Decompiling also claims computer software reduction engineering, refers to that carrying out " conversed analysis, research " by the target program (executable program) to other people software works.In the present embodiment, the initial APK file of decompiling, just obtain a readable AndroidManifest.xml file and first resource file, there is no decompiling java code, dex file in initial APK file does not also carry out decompiling, can know in subsequent steps, not need to compile the code of initial APK file just to can be implemented as initial APK file increase function.One AndroidManifest.xml file is corresponding with Secondary resource file with the 2nd AndroidManifest.xml file in shelf document with first resource file.Make use of in the process of decompiling initial APKtool (APKTool is the APK compilation tool that GOOGLE provides, can decompiling and return compiling apk) file that provides.By the initial APK file of decompiling, for packing builds the basic document that new APK file provides necessity.
In the present embodiment, shelf document is solve the simplest safest technical solution of the responsive company data of remote user access for SSLVPN, SSLVPN.Wherein, SSL (Secure Socket Layer (SSL)) agreement is a kind of puppy parc ensureing to send information security on internet, adopts B/S structure (Browser/Server, Browser/Server Mode); The English full name of VPN is " VirtualPrivateNetwork ", is exactly " VPN (virtual private network) ".Known SSLVPN shell to be added is resolved, and obtains the 2nd AndroidManifest.xml file and the Secondary resource file of shell.Certainly, in other embodiments, shelf document is not limited only to SSLVPN.By resolving SSLVPN shell, for packing builds the basic document that new initial APK file provides necessity.
S40: file destination and shelf document are carried out merging treatment;
File destination comprises an xml file and the first resource file of initial APK file, and shelf document comprises the 2nd xml file and Secondary resource file;
File destination and shelf document are carried out merging treatment specifically comprise:
S41: resolve an xml file and the 2nd xml file;
In the present embodiment, an xml file is an AndroidManifest.xml file, and the 2nd xml file is the 2nd AndroidManifest.xml file; A MainActivity information of initial APK file, an Application information can be obtained after resolving an AndroidManifest.xml file, and the out of Memory of AndroidManifest.xml file, wherein also comprise the bag name of initial APK file; After resolving the 2nd AndroidManifest.xml file, the 2nd MainActivity information of SSLVPN shell, the 2nd Application information can be obtained, and the out of Memory of the 2nd AndroidManifest.xml file.
S42: the content that an xml file is identical with the 2nd xml file interior joint type merges, and is merged by the file that first resource file is identical with the file type of son file in Secondary resource file;
One MainActivity information of initial APK file and the 2nd MainActivity information of SSLVPN shell are combined, in the process merged, one MainActivity information and the 2nd MainActivity are sorted, in order to first perform the shell side sequence of SSLVPN, 2nd MainActivity is arranged in before a MainActivity, and it will be set to start activity, namely " android.intent.action.MAIN " and " android.intent.category.LAUNCHER " is set, make first to perform SSLVPN before the initial APK file of execution, other activity node in one Application information of initial APK file and the 2nd Application information of SSLVPN shell is combined, in the process merged, android:name is appointed as the complete class name that shell engineering inherits android.app.Application.
In the present embodiment, first resource file comprises a strings.xml file, Secondary resource file comprises the 2nd strings.xml file, a strings.xml file and the 2nd strings.xml file is merged, and stores the file after merging in profile folder.File after merging, not only contains a strings.xml file and the 2nd strings.xml file full content, also have recorded the bag name of original apk file, and starts the information such as activity.
S50: the file after merging treatment and the storage of initial APK file are pressed from both sides to profile, and packing structure profile folder is target APK file;
File storage after merging treatment is comprised to profile folder:
The content that a described xml file is identical with described 2nd xml file interior joint type is carried out file storage that merging treatment obtains in described profile folder; The file that described first resource file is identical with the file type of son file in described Secondary resource file is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile.
The content do not merged in first resource file storage is pressed from both sides to profile.In the present embodiment, by the file in first resource file except a strings.xml file, preserve under copying catalogue corresponding in Secondary resource file to, then the first resource file be combined and Secondary resource file are stored in profile folder.
Merge the item do not merged in an xml file and the 2nd xml file.Out of Memory in the 2nd AndroidManifest.xml file obtained after out of Memory in the AndroidManifest.xml file obtained after parsing the one AndroidManifest.xml file and parsing the 2nd AndroidManifest.xml file is combined, and the file after being combined is stored in profile folder.By the file destination of initial APK file and SSLVPN shelf document are combined, provide important ingredient for packing builds new target APK file, provide driving for new target AP K starts.
The file destination of initial APK file and SSLVPN shelf document are being combined, and after storage to profile folder, under also needing initial APK file to be copied to profile folder.The function that initial APK file provides initial APK file originally to have for target APK file.In the process of packing profile folder, need call apktool and use ant (Ant is a kind of build instrument based on Java).
The above-mentioned process for adding a shell to an initial APK file of Mobile solution, when initial APK file needs the shell increasing other function, using target APK file as source document, selects other shelf document, then carries out according to above-mentioned method and step.
The present embodiment obtains an xml file and first resource file by first carrying out decompiling to initial APK file, then the process such as merging are carried out to the 2nd xml file of an xml file and shell to be added, first resource file and Secondary resource file are carried out to the process such as merging and the file after process is stored into profile folder, finally profile is pressed from both sides packing and be built into target APK file, to realize the object function of shell to be added be attached in initial APK file, do not need the source code changing initial APK file in the process, the file structure revising dex is not needed yet, flexible when making to increase new function to existing Mobile solution, simple, be conducive to the more simple and efficient customization of enterprise and transform original enterprise mobile application.
Reference Fig. 3, Fig. 3 are the schematic flow sheet that the present invention expands method the 3rd embodiment of APK file application.
On the basis of above-described embodiment, before execution step S50, the method that the present invention expands APK file application also comprises:
S60: add preset label information in the xml file of profile folder;
In the present embodiment, before the file preferably do not merged in merging the one xml file and the 2nd xml file, generate the icon icon of target Apk.Icon generation is the amendment to initial APK file icon icon.Process initial APK file icon process in, using the icon main body of the icon of initial APK file as target APK file, and add in icon main body correspondence add shell mark.In the present embodiment, xml file is preferably AndroidManifest.xml file, is added in AndroidManifest.xml file by the label information of corresponding function shell.A kind of function shell is to a kind of label information, and the type of label information can pre-set according to the demand of user.
By adding the label information representing function shell in initial APK file AndroidManifest.xml file, target AP K file is made to be different from initial APK file, and make from target APK file AndroidManifest.xml file, to identify the function shell added by this APK file, thus be conducive to avoiding repeating to add shell to same APK file.
Reference Fig. 4, Fig. 4 are the schematic flow sheet that the present invention expands method the 4th embodiment of APK file application.
On the basis of above-described embodiment, before execution step S20, the method that the present invention expands APK file application also comprises:
S70: the file type obtaining initial APK file, judges whether the type of APK file is APK type;
S80: if the type of initial APK file is APK type, obtains the xml file of initial APK file, judge whether there is preset label information in xml file; When there is not preset label information in xml file, extraction module extracts the file destination identical with the file type of shelf document from the file after decompiling process.
In the present embodiment, xml file is preferably AndroidManifest.xml file, before carrying out decompiling to initial APK file, also needs to detect initial APK file, to judge whether the initial APK file for decompiling meets the requirement of decompiling.Particularly, judge whether initial APK file meets decompiling and require to include the following aspects:
First, judge whether this file is genuine initial APK file, and whether a file is qualified initial APK file, and can not only judge from suffix name, after other file makes suffix name into initial APK, this file also will be shown as initial APK file.Such as, after the suffix name doc of word document is modified as initial APK, the formal of word document just becomes initial APK file.The judgement of this part is the file type first obtaining initial APK file, then judges whether the type of APK file is APK type, if APK type, then continues judgement below, if not APK type, then exit cryptor.Certainly, judge whether APK file is that genuine APK file also can be undertaken by decompiling, by changing the suffix name not being apk file into .apk, decompiling instrument can provide relevant prompting.
Then, judging the function whether comprising shelf document in the initial APK file for adding shell, is complete judgement by detecting in initial APK file the identification information whether comprising shelf document corresponding in the present embodiment.Whether an initial APK file meets adds shell requirement, except determining that this file is except very initial APK file, also need to judge that this initial APK file is the need of the function increasing shelf document, if detect that initial APK file has possessed the function of shelf document, then no longer need to increase same shelf document to same initial APK file, if the identification information of shelf document do not detected, then shell process is added to initial APK file.Particularly, first the AndroidManifest.xml file of APK file is obtained, then judge whether comprise the presetting mark information corresponding with shelf document in AndroidManifest.xml file, if existed, then no longer shell is added to initial APK file, if there is no, then subsequent treatment is carried out to the initial APK file after decompiling.
Before the initial APK file after extracting decompiling, the legitimacy of initial APK file is judged, effectively eliminates the file of non-APK type, avoid and unnecessary process is carried out to the file of non-APK type; The necessity initial APK file being added to shell judges, has effectively stopped the operation initial APK file heavily being added to shell, has improve efficiency Mobile solution being added to shell.
Reference Fig. 5, Fig. 5 are the schematic flow sheet that the present invention expands method the 5th embodiment of APK file application.
On the basis of above-described embodiment, before execution step S50, the method that the present invention expands APK file application also comprises:
S90: the filename that profile presss from both sides is revised as consistent with the filename of initial APK file;
In the present embodiment, before the preferred file do not merged in merging the one xml file and the 2nd xml file had, the file of definition profile folder is called the filename of initial APK file.When defining the filename of profile folder, in order to better recognize and performance objective APK file, the filename of the profile folder before packing being built is defined as the filename of initial APK file.When parsing the one AndroidManifest.xml, obtain the raw filename of initial APK file, and the filename that profile presss from both sides is replaced to the filename of initial APK file.Be defined as the filename of initial APK file by the filename pressed from both sides by profile, the filename of the target APK file that packing is built is identical with the filename of initial APK file, is conducive to the identification of user to target APK file.
In the process that target AP K runs, owing to have modified AndroidManifest file, first target AP K can start the attachBaseContext method in the Application subclass performing and specify, and in the method the mClassLoader in android.app.LoadApk is pointed to initial APK file.Then, if initial APK file has Application subclass, then the Application of self is performed.Start first Activity adding the application of SSLVPN shell, the login interface of display VPN.After inputting correct username and password, Successful login SSLVPN, starts first Activity of the initial APK file that mClassLoader points to afterwards.Then, initial APK can bring into use, and the network interaction of just former application all can walk the SSLVPN tunnel after encryption.
The present invention further provides a kind of device expanding APK file application.
Reference Fig. 6 and Fig. 7, Fig. 6 are the high-level schematic functional block diagram that the present invention expands device first embodiment of APK file application; Fig. 7 is the high-level schematic functional block diagram that the present invention expands device second embodiment of APK file application.
In one embodiment, the device of this expansion APK file application comprises:
Acquisition module 10, for obtaining initial APK file and shelf document;
Receive the initial APK file that user prepares to add shell, receive the instruction that user selects shelf document, according to the selection instruction of user, from shelf document storehouse, extract required shelf document.
Decompiling module 20, for the initial APK file of decompiling, and obtains the file destination of described initial APK file;
Extraction module 30, for extracting the file destination identical with the file type of shelf document from the file after decompiling process;
Decompiling also claims computer software reduction engineering, refers to that carrying out " conversed analysis, research " by the target program (executable program) to other people software works.In the present embodiment, the initial APK file of decompiling, just obtain a readable AndroidManifest.xml file and first resource file, there is no decompiling java code, dex file in initial APK file does not also carry out decompiling, can know in subsequent steps, not need to compile the code of initial APK file just to can be implemented as initial APK file increase function.One AndroidManifest.xml file is corresponding with Secondary resource file with the 2nd AndroidManifest.xml file in shelf document with first resource file.The file that initial APKtool provides is make use of in the process of decompiling.By the initial APK file of decompiling, for packing builds the basic document that new initial APK file provides necessity.
In the present embodiment, shelf document is solve the simplest safest technical solution of the responsive company data of remote user access for SSLVPN, SSLVPN.Wherein, SSL (Secure Socket Layer (SSL)) agreement is a kind of puppy parc ensureing to send information security on internet, adopts B/S structure (Browser/Server, Browser/Server Mode); The English full name of VPN is " VirtualPrivateNetwork ", is exactly " VPN (virtual private network) ".Known SSLVPN shell to be added is resolved, and obtains the 2nd AndroidManifest.xml file and the Secondary resource file of shell.Certainly, in other embodiments, shelf document is not limited only to SSLVPN.By resolving SSLVPN shell, for packing builds the basic document that new initial APK file provides necessity.
Merge module 40, file destination and shelf document are carried out merging treatment;
File destination comprises an xml file and the first resource file of initial APK file, and shelf document comprises the 2nd xml file and Secondary resource file;
File destination and shelf document are carried out merging treatment specifically comprise:
Resolution unit 41: for resolving an xml file and the 2nd xml file;
In the present embodiment, an xml file is an AndroidManifest.xml file, and the 2nd xml file is the 2nd AndroidManifest.xml file; A MainActivity information of initial APK file, an Application information can be obtained after resolving an AndroidManifest.xml file, and the out of Memory of AndroidManifest.xml file, wherein also comprise the bag name of initial APK file; After resolving the 2nd AndroidManifest.xml file, the 2nd MainActivity information of SSLVPN shell, the 2nd Application information can be obtained, and the out of Memory of the 2nd AndroidManifest.xml file.
Merge cells 42: the content that an xml file is identical with the 2nd xml file interior joint type merges, and is merged by the file that first resource file is identical with the file type of son file in Secondary resource file;
One MainActivity information of initial APK file and the 2nd MainActivity information of SSLVPN shell are combined, in the process merged, one MainActivity information and the 2nd MainActivity are sorted, in order to first perform the shell side sequence of SSLVPN, 2nd MainActivity is arranged in before a MainActivity, and it will be set to start activity, namely " android.intent.action.MAIN " and " android.intent.category.LAUNCHER " is set, make first to perform SSLVPN before the initial APK file of execution, activity node in one Application information of initial APK file and the 2nd Application information of SSLVPN shell is combined, and be stored in preset file, in the process merged, android:name is appointed as the complete class name that shell engineering inherits android.app.Application.
In the present embodiment, first resource file comprises a strings.xml file, Secondary resource file comprises the 2nd strings.xml file, a strings.xml file and the 2nd strings.xml file is merged, and stores the file after merging in profile folder.File after merging, not only contains a strings.xml file and the 2nd strings.xml file full content, also have recorded the bag name of original apk file, and starts the information such as activity.
Pack and build module 50, for the file after merging treatment and the storage of initial APK file being pressed from both sides to profile, and packing structure profile folder is target APK file;
File storage after merging treatment is comprised to profile folder:
The content that a described xml file is identical with described 2nd xml file interior joint type is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile; The file that described first resource file is identical with the file type of son file in described Secondary resource file is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile.
The content do not merged in first resource file is stored to Secondary resource file, and storage to profile presss from both sides.In the present embodiment, by the file in first resource file except a strings.xml file, preserve under copying catalogue corresponding in Secondary resource file to, then the first resource file be combined and Secondary resource file are stored in profile folder.
Merge the file do not merged in an xml file and the 2nd xml file, and storage to profile presss from both sides.Out of Memory in the 2nd AndroidManifest.xml file obtained after out of Memory in the AndroidManifest.xml file obtained after parsing the one AndroidManifest.xml file and parsing the 2nd AndroidManifest.xml file is combined, and the file after being combined is stored in profile folder.By the shelf document of the file destination of initial APK file and SSLVPN file is combined, provide important ingredient for packing builds new target APK file, provide driving for new target AP K starts.
The shelf document of the file destination of initial APK file and SSLVPN file is being combined, and after storage to profile folder, under also needing initial APK file to be copied to profile folder.The function that initial APK file provides initial APK file originally to have for target APK file.In the process of packing profile folder, need call apktool and use ant (Ant is a kind of build instrument based on Java).
The above-mentioned process for adding a shell to an initial APK file of Mobile solution, when initial APK file needs the shell increasing other function, using target APK file as source document, selects other shelf document, then carries out according to above-mentioned method and step.
The present embodiment obtains an xml file and first resource file by first carrying out decompiling to initial APK file, then the process such as merging are carried out to the 2nd xml file of an xml file and shell to be added, first resource file and Secondary resource file are carried out to the process such as merging and the file after process is stored into profile folder, finally profile is pressed from both sides packing and be built into target APK file, to realize the object function of shell to be added be attached in initial APK file, do not need the source code changing initial APK file in the process, the file structure revising dex is not needed yet, flexible when making to increase new function to existing Mobile solution, simple, be conducive to the more simple and efficient customization of enterprise and transform original enterprise mobile application.
Reference Fig. 8, Fig. 8 are the schematic flow sheet that the present invention expands device the 3rd embodiment of APK file application.
On the basis of above-described embodiment, the device that the present invention expands APK file application also comprises:
Mark module 60, adds preset label information in the xml file of profile folder;
In the present embodiment, before the file preferably do not merged in merging the one xml file and the 2nd xml file, generate the icon icon of target Apk.Icon generation is the amendment to initial APK file icon icon.Process initial APK file icon process in, using the icon main body of the icon of initial APK file as target APK file, and add in icon main body correspondence add shell mark.In the present embodiment, xml file is preferably AndroidManifest.xml file, is added in AndroidManifest.xml file by the label information of corresponding function shell.A kind of function shell is to a kind of label information, and the type of label information can pre-set according to the demand of user.
By adding the label information representing function shell in initial APK file AndroidManifest.xml file, target AP K file is made to be different from initial APK file, and make from target APK file AndroidManifest.xml file, to identify the function shell added by this APK file, thus be conducive to avoiding repeating to add shell to same APK file.
Reference Fig. 9, Fig. 9 are the schematic flow sheet that the present invention expands device the 4th embodiment of APK file application.
On the basis of above-described embodiment, the device that the present invention expands APK file application also comprises:
First judge module 70, for obtaining the file type of initial APK file, judges whether the type of APK file is APK type;
Second judge module 80, if be APK type for the type of initial APK file, obtain the xml file of initial APK file, judges whether there is preset label information in xml file; Also for when there is not preset label information in the second judge module 80, extraction module extracts the file destination identical with the file type of shelf document from the file after decompiling process in xml file.
In the present embodiment, xml file is preferably AndroidManifest.xml file, before carrying out decompiling to initial APK file, also needs to detect initial APK file, to judge whether the initial APK file for decompiling meets the requirement of decompiling.Particularly, judge whether initial APK file meets decompiling and require to include the following aspects:
First, judge whether this file is genuine initial APK file, and whether a file is qualified initial APK file, and can not only judge from suffix name, after other file makes suffix name into initial APK, this file also will be shown as initial APK file.Such as, after the suffix name doc of word document is modified as initial APK, the formal of word document just becomes initial APK file.The judgement of this part is the file type first obtaining initial APK file, then judges whether the type of APK file is APK type, if APK type, then continues judgement below, if not APK type, then exit cryptor.Certainly, judge whether APK file is that genuine APK file also can be undertaken by decompiling, by changing the suffix name not being apk file into .apk, decompiling instrument can provide relevant prompting.
Then, judging the function whether comprising shelf document in the initial APK file for adding shell, is complete judgement by detecting in initial APK file the identification information whether comprising shelf document corresponding in the present embodiment.Whether an initial APK file meets adds shell requirement, except determining that this file is except very initial APK file, also need to judge that this initial APK file is the need of the function increasing shelf document, if detect that initial APK file has possessed the function of shelf document, then no longer need to increase same shelf document to same initial APK file, if the identification information of shelf document do not detected, then shell process is added to initial APK file.Particularly, first the AndroidManifest.xml file of APK file is obtained, then judge whether comprise the presetting mark information corresponding with shelf document in AndroidManifest.xml file, if existed, then no longer shell is added to initial APK file, if there is no, then initial APK file is extracted.
Before the initial APK file after extracting decompiling, the legitimacy of initial APK file is judged, effectively eliminates the file of non-APK type, avoid and unnecessary process is carried out to the file of non-APK type; The necessity initial APK file being added to shell judges, has effectively stopped the operation initial APK file heavily being added to shell, has improve efficiency Mobile solution being added to shell.
Reference Figure 10, Figure 10 are the schematic flow sheet that the present invention expands device the 5th embodiment of APK file application.
On the basis of above-described embodiment, the device that the present invention expands APK file application also comprises:
Replacement module 90, the filename for being pressed from both sides by profile is revised as consistent with the filename of initial APK file;
In the present embodiment, before the preferred file do not merged in merging the one xml file and the 2nd xml file had, the file of definition profile folder is called the filename of initial APK file.When defining the filename of profile folder, in order to better recognize and performance objective APK file, the filename of the profile folder before packing being built is defined as the filename of initial APK file.When parsing the one AndroidManifest.xml, obtain the raw filename of initial APK file, and the filename that profile presss from both sides is replaced to the filename of initial APK file.Be defined as the filename of initial APK file by the filename pressed from both sides by profile, the filename of the target APK file that packing is built is identical with the filename of initial APK file, is conducive to the identification of user to target APK file.
In the process that target AP K runs, owing to have modified AndroidManifest file, first target AP K can start the attachBaseContext method in the Application subclass performing and specify, and in the method the mClassLoader in android.app.LoadApk is pointed to initial APK file.Then, if initial APK file has Application subclass, then the Application of self is performed.Start first Activity adding the application of SSLVPN shell, the login interface of display VPN.After inputting correct username and password, Successful login SSLVPN, starts first Activity of the initial APK file that mClassLoader points to afterwards.Then, initial APK can bring into use, and the network interaction of just former application all can walk the SSLVPN tunnel after encryption.
These are only the preferred embodiments of the present invention; not thereby the scope of the claims of the present invention is limited; every utilize instructions of the present invention and accompanying drawing content to do equivalent structure or equivalent flow process conversion; or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.

Claims (10)

1. expand a method for APK file application, it is characterized in that, the method for expansion APK file application comprises the following steps:
Obtain initial APK file and shelf document;
Decompiling process is carried out to described initial APK file;
The file destination identical with the file type of described shelf document is extracted from the file after decompiling process;
Described file destination and described shelf document are carried out merging treatment;
File after merging treatment and described initial APK file storage are pressed from both sides to profile, and the described profile folder of packing structure is target APK file.
2. the method for expansion APK file as claimed in claim 1 application, it is characterized in that, described file destination comprises an xml file and first resource file, and described shelf document comprises the 2nd xml file and Secondary resource file;
Describedly merging treatment carried out to described file destination and described shelf document comprise:
Resolve a described xml file and described 2nd xml file;
The content that a described xml file is identical with described 2nd xml file interior joint type merges, and is merged by the file that described first resource file is identical with the file type of son file in described Secondary resource file;
File storage after merging treatment is comprised to profile folder:
The content that a described xml file is identical with described 2nd xml file interior joint type is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile;
The file that described first resource file is identical with the file type of son file in described Secondary resource file is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile.
3. the method for expansion APK file as claimed in claim 2 application, it is characterized in that, described by the file after merging treatment and the storage of described initial APK file to profile folder, and packing also comprises before building the step that described profile folder is target APK file:
Preset label information is added in the xml file that described profile presss from both sides.
4. the method for expansion APK file as claimed in claim 3 application, is characterized in that, described initial APK file is carried out to the step of decompiling process after also comprise:
Obtain the file type of described initial APK file, judge whether the type of described APK file is APK type;
If the type of described initial APK file is APK type, obtain the xml file of described initial APK file, judge whether there is preset label information in described xml file;
When there is not preset label information in described xml file, perform the described file destination that extraction is identical with the file type of described shelf document from the file after decompiling process.
5. as the method for the expansion APK file application in Claims 1-4 as described in any one, it is characterized in that, described by the file after merging treatment and the storage of described initial APK file to profile folder, and packing also comprises before building the step that described profile folder is target APK file:
The filename that described profile presss from both sides is revised as consistent with the filename of described initial APK file.
6. expand a device for APK file application, it is characterized in that, the device of described expansion APK file application comprises:
Acquisition module, for obtaining initial APK file and shelf document;
Decompiling module, for carrying out decompiling process to described initial APK file;
Extraction module, for extracting the file destination identical with the file type in described shelf document from the file after decompiling process;
Merge module, for described file destination and described shelf document are carried out merging treatment;
Pack and build module: for the file after merging treatment and described initial APK file storage being pressed from both sides to profile, and the described profile folder of packing structure is target APK file.
7. the device of expansion APK file as claimed in claim 6 application, it is characterized in that, described merging module comprises:
Resolution unit, for resolving a described xml file and described 2nd xml file;
Merge cells, merges for the content that a described xml file is identical with described 2nd xml file interior joint type, and is merged by the file that described first resource file is identical with the file type of son file in described Secondary resource file;
Described packing builds module and carries out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile specifically for the content that a described xml file is identical with described 2nd xml file interior joint type;
The file that described first resource file is identical with the file type of son file in described Secondary resource file is carried out during the file that merging treatment obtains and the file not carrying out merging treatment all store and press from both sides to described profile.
8. the device of expansion APK file as claimed in claim 7 application, is characterized in that, the device of described expansion APK file application also comprises:
Mark module, adds preset label information in the xml file that presss from both sides at described profile.
9. the device of expansion APK file as claimed in claim 8 application, is characterized in that, the device of described expansion APK file application also comprises:
First judge module, for obtaining the file type of described initial APK file, judges whether the type of described APK file is APK type;
Second judge module, if be APK type for the type of described initial APK file, obtains the xml file of described initial APK file, judges whether there is preset label information in described xml file;
Described second judge module also for, when there is not preset label information in described xml file, extraction module extracts the file destination identical with the file type of described shelf document from the file after decompiling process.
10. as the device of the expansion APK file application in claim 6 to 9 as described in any one, it is characterized in that, the device of described expansion APK file application also comprises:
Replacement module, the filename for being pressed from both sides by described profile is revised as consistent with the filename of described initial APK file.
CN201410529570.XA 2014-10-08 2014-10-08 Extend the method and device of APK file application Active CN105574000B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201410529570.XA CN105574000B (en) 2014-10-08 2014-10-08 Extend the method and device of APK file application
PCT/CN2015/071471 WO2016054880A1 (en) 2014-10-08 2015-01-23 Apk file application expanding method and device
PCT/CN2015/074404 WO2015154612A1 (en) 2014-10-08 2015-03-17 Method and device for extending apk file application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410529570.XA CN105574000B (en) 2014-10-08 2014-10-08 Extend the method and device of APK file application

Publications (2)

Publication Number Publication Date
CN105574000A true CN105574000A (en) 2016-05-11
CN105574000B CN105574000B (en) 2019-11-05

Family

ID=54287312

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410529570.XA Active CN105574000B (en) 2014-10-08 2014-10-08 Extend the method and device of APK file application

Country Status (2)

Country Link
CN (1) CN105574000B (en)
WO (2) WO2016054880A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020725A (en) * 2016-05-20 2016-10-12 努比亚技术有限公司 Application file processing apparatus and method
CN106325917A (en) * 2016-08-09 2017-01-11 盛趣信息技术(上海)有限公司 Method and system for realizing module access of reverse program
CN106775842A (en) * 2016-11-30 2017-05-31 北京酷我科技有限公司 A kind of method of the dex subpackages that can customize
CN107992265A (en) * 2016-10-27 2018-05-04 中兴通讯股份有限公司 A kind of method of inspection and device of the source file of application program
CN110941443A (en) * 2019-12-12 2020-03-31 支付宝(杭州)信息技术有限公司 Method and device for modifying file name in SDK and electronic equipment
CN112099880A (en) * 2020-08-12 2020-12-18 北京大学 Method and system for reducing application program driven by scene
US11972244B2 (en) 2020-11-13 2024-04-30 Iron Gaming Limited Method and apparatus for improving a mobile application

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107908964B (en) * 2017-10-17 2021-06-08 珠海金山网络游戏科技有限公司 Security detection method and device for shell files in Android platform Unity3D game
CN108154011A (en) * 2018-01-12 2018-06-12 广州汇智通信技术有限公司 Hulling method, system, equipment and readable storage medium storing program for executing based on art patterns
CN109117175B (en) * 2018-07-31 2022-01-28 成都华栖云科技有限公司 APK decompilation-based desktop end packaging method and packaging tool for fast packaging
CN111045686B (en) * 2019-12-16 2023-05-30 北京智游网安科技有限公司 Method for improving decompilation speed of application, intelligent terminal and storage medium
CN113721929A (en) * 2021-08-11 2021-11-30 安徽帕觅智能科技有限公司 Method for automatically implanting common code into Android App
CN113934460A (en) * 2021-10-12 2022-01-14 郑州阿帕斯数云信息科技有限公司 Resource providing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177077A (en) * 2013-01-08 2013-06-26 杭州米加科技有限公司 APK file storing and outputting method
CN103530535A (en) * 2013-10-25 2014-01-22 苏州通付盾信息技术有限公司 Shell adding and removing method for Android platform application program protection
CN103886230A (en) * 2014-02-24 2014-06-25 四川长虹电器股份有限公司 Software copyright protection method of android system and system thereof
US20140181803A1 (en) * 2012-12-21 2014-06-26 Bmc Software Acquisition, L.L.C. Application wrapping system and method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101391982B1 (en) * 2012-08-28 2014-05-07 바른소프트기술 주식회사 Encryption method for preventing decompile of andriod application
WO2014142430A1 (en) * 2013-03-15 2014-09-18 주식회사 에스이웍스 Dex file binary obfuscation method in android system
CN103761457A (en) * 2013-12-27 2014-04-30 华为技术有限公司 Software protecting method, device and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140181803A1 (en) * 2012-12-21 2014-06-26 Bmc Software Acquisition, L.L.C. Application wrapping system and method
CN103177077A (en) * 2013-01-08 2013-06-26 杭州米加科技有限公司 APK file storing and outputting method
CN103530535A (en) * 2013-10-25 2014-01-22 苏州通付盾信息技术有限公司 Shell adding and removing method for Android platform application program protection
CN103886230A (en) * 2014-02-24 2014-06-25 四川长虹电器股份有限公司 Software copyright protection method of android system and system thereof

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020725A (en) * 2016-05-20 2016-10-12 努比亚技术有限公司 Application file processing apparatus and method
CN106020725B (en) * 2016-05-20 2019-07-12 努比亚技术有限公司 Application file processing unit and method
CN106325917A (en) * 2016-08-09 2017-01-11 盛趣信息技术(上海)有限公司 Method and system for realizing module access of reverse program
CN106325917B (en) * 2016-08-09 2019-12-06 盛趣信息技术(上海)有限公司 method and system for realizing module access by reverse program
CN107992265A (en) * 2016-10-27 2018-05-04 中兴通讯股份有限公司 A kind of method of inspection and device of the source file of application program
CN106775842A (en) * 2016-11-30 2017-05-31 北京酷我科技有限公司 A kind of method of the dex subpackages that can customize
CN110941443A (en) * 2019-12-12 2020-03-31 支付宝(杭州)信息技术有限公司 Method and device for modifying file name in SDK and electronic equipment
CN112099880A (en) * 2020-08-12 2020-12-18 北京大学 Method and system for reducing application program driven by scene
CN112099880B (en) * 2020-08-12 2021-07-30 北京大学 Method and system for reducing application program driven by scene
US11972244B2 (en) 2020-11-13 2024-04-30 Iron Gaming Limited Method and apparatus for improving a mobile application

Also Published As

Publication number Publication date
CN105574000B (en) 2019-11-05
WO2016054880A1 (en) 2016-04-14
WO2015154612A1 (en) 2015-10-15

Similar Documents

Publication Publication Date Title
CN105574000A (en) Method and device for expanding APK (Android Package) file application
KR102237015B1 (en) Systems and methods for implementing native contracts on the blockchain
US10929117B2 (en) Container image building using shared resources
US10185546B2 (en) Service extraction and application composition
CN106022483B (en) The method and apparatus converted between machine learning model
CN106325965B (en) The Compilation Method and device of operating system
US8621429B2 (en) Software development support apparatus, function extension method and storage medium for storing function extension program
CN102741811A (en) Improving performance of template based JavaScript widgets
CN105577720A (en) Method and system for packaging mobile application
CN105743680A (en) Cluster disposition method and disposition device
CN113704706B (en) Code reinforcement method and device
RU2004100525A (en) METHOD AND SYSTEM FOR RECORDING MACROS IN SYNTAXIS, INDEPENDENT ON THE LANGUAGE
JP2014531091A (en) Processing method, storage medium, and client support server
CN102682237B (en) Malicious method and system are sentenced for web download file
CN115098186A (en) Project processing method and device, computer equipment and storage medium
CN109614107A (en) A kind of integrated approach and device of Software Development Kit
CN110955434B (en) Software development kit processing method and device, computer equipment and storage medium
CN110333872B (en) Application processing method, device, equipment and medium
CN104866504B (en) A kind of method and device that Function Extension is carried out to Android software
CN111309332A (en) File content on-demand loading method and device, electronic equipment and storage medium
CN112965721B (en) Project compiling method and device based on Android, computer equipment and storage medium
CN104166545A (en) Webpage resource sniffing method and device
KR101477050B1 (en) Method for extracting excutable code of application using memory dump
CN116166907B (en) Method and device for developing Web application by using WebAsssembly and service page compiling technology
CN104331665A (en) Generating method of traceable object code and traceable object code generator

Legal Events

Date Code Title Description
C06 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