Summary of the invention
In view of this, it is really necessary to provide a kind of unknown host of energy adaptation using CPU architecture and carry out the multiple application of hot repair
Restorative procedure and device.
A kind of method that Android application hot repair is multiple, including third party software development kit, third party software develop work
Tool packet includes the mutually different dynamic link library file of at least two CPU architectures;Further include following steps:
Step 1: Android application access third party software development kit;
Step 2: the correlative code of third party software development kit from the assert catalogue in Android application
It copies in the internal directory in Android application, and is generated using third party software development kit as title with configuration file
The release directory;
Step 3: obtaining the first CPU architecture information in slave mobile device, obtains from the mount message that Android is applied
The second CPU architecture information that Android application is supported;
Step 4: by comparing matching, the corresponding dynamic of optimal CPU architecture is chosen in third party software development kit
Library file is linked, and the corresponding dynamic link library file of optimal CPU architecture is copied from the assert catalogue in Android application
Library directory of the shellfish into the release directory;
Step 5: the correlative code and dynamic link library text under dexclassloader dynamically load the release directory are utilized
Part, and version information is write in configuration file.
A kind of device that Android application hot repair is multiple, including third party software development kit, third party software develop work
Tool packet includes the mutually different dynamic link library file of at least two CPU architectures;It further include processing module, matching module and load
Module;
Processing module is used for:
By Android application access third party software development kit;
The correlative code of third party software development kit and configuration text from the assert catalogue in Android application
Part copies in the internal directory in Android application, and generates using third party software development kit as the version mesh of title
Record;
The first CPU architecture information is obtained in slave mobile device, obtains Android from the mount message that Android is applied
Using the second CPU architecture information of support;
Matching module is used for:
By comparing matching, the corresponding dynamic link library of optimal CPU architecture is chosen in third party software development kit
File, and the corresponding dynamic link library file of optimal CPU architecture is copied to version from the assert catalogue in Android application
Library directory in this catalogue;
Loading module is used for:
Using the correlative code and dynamic link library file under dexclassloader dynamically load the release directory, and version
This information is write in configuration file.
The multiple method and apparatus of above-mentioned Android application hot repair, can in unknown host's application runtime environment CPU architecture
Under the premise of, automatic identification and the CPU architecture being adapted in host's application runtime environment, and hot repair function is completed, while yet
The release directory can be controlled and be switched.
Specific embodiment
To illustrate thought and purpose of the invention, the present invention is done further below in conjunction with the drawings and specific embodiments
Explanation.
Fig. 1 is the multiple method flow diagram of the Android application hot repair that provides of first embodiment of the invention.Under this method includes
Face step:
Wherein, third party software development kit, which can be, some is used for by software engineer as specific software package, soft
Part frame, hardware platform, operating system etc. establish the set of the developing instrument of application software.Signified third party in the present embodiment
Software Development Kit includes the different Dynamic link library library file of common several CPU architectures, wherein Dynamic link library library file
Applicable CPU architecture includes but is not limited only to the frameworks such as 32 series, 64 series, arm and x86 series.
S101:Android application access third party software development kit.
S102: from the assert catalogue in Android application in the related generation of third party software development kit
Code is copied to configuration file in the internal directory in Android application, and is generated with the release directory.Correlative code refers to energy
Enough realize the multiple core code of Android application hot repair.
S103: obtaining the first CPU architecture information of mobile device and obtains the 2nd CPU frame that Android application is supported
Structure information;
From after 5.0 version updating of android system, android system can be when an application installation, will
In the application, step S103 is mentioned the information preservation about CPU architecture for the dynamic link library file that Android application provides
The the second CPU architecture information arrived.If the first CPU architecture information might not be exactly matched with the second CPU architecture information, but most be closed
Suitable or immediate CPU architecture information.
S104: by comparing matching, the corresponding dynamic chain of optimal CPU architecture is chosen in third party software development kit
Library file is connect, and the corresponding dynamic link library file of optimal CPU architecture is copied from the assert catalogue in Android application
Library directory into the release directory;
By by the comprehensive comparison of the first CPU architecture information, the second CPU architecture information and third party software development kit
Matching, obtains a most suitable CPU architecture information, and by the most suitable CPU frame in third party software development kit
The corresponding dynamic link library file of structure information is copied in library directory.
If the Android application in without use dynamic link library file, then then directly by in mobile device
The first CPU architecture information that upper acquisition obtains is compared matching and obtains most suitable CPU architecture information.
S105: using the correlative code and dynamic link library file under dexclassloader dynamically load the release directory,
And version information is write in configuration file.
Android in the present embodiment not only may be implemented using hot restorative procedure in the Android for not issuing new version
Hot repair function is completed under the premise of, it is often more important that can be adapted to each under the premise of the CPU architecture information of unknown host
It plants the different mobile device of CPU architecture and reaches the multiple function of hot repair, solving current hot repair again cannot be in CPU architecture difference
Mobile device on problem.
Fig. 2 is the multiple method flow diagram of the Android application hot repair that provides of second embodiment of the invention, more than the present embodiment
Based on stating first embodiment, this method further include:
S201: judging whether Android application runs for the first time,
If it is, executing S203;If it is not, then executing S207.
Because android system can be when an application installation, by Android using the dynamic link library text provided
The information preservation about CPU architecture of part in the application, so when Android application be not for the first time run when,
Centainly record has relevant information in corresponding android system.That is the Android application of secondary operation can use
The information that its correlation has been kept is operated, and can achieve the effect for saving part unnecessary operations.If Android is answered
With being when running on the mobile apparatus for the first time, subsequent movement is identical as the first embodiment in the present invention.
S207: the quantity of the release directory in internal directory is checked;
If the quantity of the release directory be greater than 1, execute S210 (first read configuration file, according to configuration information come
Load corresponding the release directory code, and more new configuration file), then execute S211: judge configuration information whether with version mesh
Whether record matches;S206 is executed if matching, S212 is executed if mismatching and (newest the release directory code is selected to add
It carries, and more new configuration file);Finally execute S206.
If the quantity of the release directory is equal to 1, execution S209 (it is loaded directly into the code of the release directory,
And more new configuration file), then execute S206.
While Android application needs to constantly update, third party software development kit, which similarly exists, to be needed more
News, if be updated not in time to the content of third party software development kit, it is likely that it is caused to service nothing
Method normally provides, and services again to preferably provide hot repair, completes loading action using dexclassloader dynamically load
Later, we also need to carry out detection update to the content of third party software development kit.
As described in Figure 3 is the subsequent of the multiple method flow diagram of the Android application hot repair that second embodiment of the invention provides
Part, this method further include:
S213: judge third party software development kit with the presence or absence of new version;
If it is, loading newest third party software development kit to internal directory, and generate new the release directory;
Otherwise Android application is continued to run.
S216: judge whether newest third party software development kit is complete;If it is, new version information is remembered
It records in configuration file;Otherwise it is deleted and re-starts load.
S219: judge whether the quantity of the release directory is greater than three;If quantity is greater than three, created according to the release directory
The time sequencing built successively deletes the earliest the release directory of creation time;If quantity is not more than three, continue to run
Android application.
It is controlled and is switched using the release directory third party software development kit multiple to hot repair in the present embodiment, had
Effect prevents because the reasons such as network state or loading procedure interrupt suddenly cause file packet to damage, can be automatically to damage text
Part is deleted and is reloaded, and the user experience of application program is greatly improved.On the other hand, by legacy version
Third party software development kit carries out periodic cleaning, efficiently solves the problems, such as that Android application is excessively too fat to move.
Fig. 4 is the multiple apparatus structure schematic diagram of the Android application hot repair that provides of first embodiment of the invention, the device packet
Include processing module 301, matching module 302, loading module 303 and detection module 304.Preferably, detection module 304 includes first
Detection module, the second detection module, third detection module, the 4th detection module, the 5th detection module and the 6th detection module.
The multiple device of Android application hot repair in the present embodiment, including third party software development kit, third party software
Development kit includes the mutually different dynamic link library file of at least two CPU architectures;It further include processing module 301, matching
Module 302 and loading module 303;
Processing module 301 is used for:
By Android application access third party software development kit;
The correlative code of third party software development kit and configuration text from the assert catalogue in Android application
Part copies in the internal directory in Android application, and generates using third party software development kit as the version mesh of title
Record;
The first CPU architecture information is obtained in slave mobile device, obtains Android from the mount message that Android is applied
Using the second CPU architecture information of support;
Matching module 302 is used for:
By comparing matching, the corresponding dynamic link library of optimal CPU architecture is chosen in third party software development kit
File, and the corresponding dynamic link library file of optimal CPU architecture is copied to version from the assert catalogue in Android application
Library directory in this catalogue;
Loading module 303 is used for:
Using the correlative code and dynamic link library file under dexclassloader dynamically load the release directory, and version
This information is write in configuration file.
Wherein, first detection module is for detecting whether Android application runs on the mobile apparatus for the first time, the second inspection
Survey the quantity that module is used to detect the release directory in internal directory;
If Android application is to run on the mobile apparatus for the first time, processing module, matching module and load are executed
Module;If Android application is not when running for the first time, to execute the second detection module;
If the quantity of the release directory is one, the release directory number of current third party Software Development Kit
Configuration file is recorded, then executes loading module;When the quantity of the release directory is greater than one, remembered according to configuration file
The third party software development kit version number information of record loads corresponding release content, then executes loading module.
The multiple device of Android application hot repair further includes third detection module in the present embodiment, and third detection module is used for
Detection judges whether configuration file message matches with the release directory, if it does, then executing loading module;If mismatched,
It then selects newest the release directory code to load, and more new configuration file, then executes loading module.
The multiple device of Android application hot repair further includes third detection module in the present embodiment, and third detection module is used for
Detecting third party software development kit whether there is new version;If third party software development kit there are new version,
Newest third party software development kit is loaded to internal directory, and generates new the release directory;If there is no new version
Then continue to run Android application.
The multiple device of Android application hot repair further includes the 4th detection module in the present embodiment, and the 4th detection module is used for
Detect newest third party software development kit;If complete, new version information is recorded in configuration file;If
It is imperfect, then it is deleted and re-starts load.
The multiple device of Android application hot repair further includes the 5th detection module in the present embodiment, and the 5th detection module is used for
Whether the quantity for detecting the release directory of third party software development kit is greater than three;If quantity is greater than three, according to
The time sequencing of the release directory creation successively deletes the earliest the release directory of creation time;If quantity is not more than three, after
Reforwarding row Android application.
Above-described embodiment is simply to illustrate that this technology design and feature, its purpose is allow technology people in the art
Member cans understand the content of the present invention and implement it accordingly, and it is not intended to limit the scope of the present invention.It is all according to this hair
Equivalent changes or modifications, should be covered by the scope of protection of the present invention made by the essence of bright content.