Summary of the invention:
In view of this, it is necessary that providing a kind of adaptive unknown host can apply CPU architecture and carry out the multiple application restorative procedure of hot repair and device in fact.
A kind of method that Android application hot repair is multiple, including third party software development kit, third party software developing instrument includes the mutually different dynamic link library file of at least two CPU architecture;Also comprise the steps:
Step one: Android application accesses third party software development kit;
Step 2: in the assert catalogue from Android applies, the correlative code of third party software development kit and configuration file are copied in the internal directory in Android application, and generate the release directory with third party software development kit as title;
Step 3: obtain the first CPU architecture information from mobile device, obtains the second CPU architecture information that Android application is supported from the mount message of Android application;
Step 4: pass through comparison match, in third party software development kit, choose the dynamic link library file that optimum CPU architecture is corresponding, and the assert catalogue from Android applies copies the library directory in the release directory to dynamic link library corresponding for optimum CPU architecture;
Step 5: utilize the code under dexclassloader dynamic load the release directory and dynamic link library file, and version information is write in configuration file.
The device that a kind of Android application hot repair is multiple, including third party software development kit, third party software developing instrument includes the mutually different dynamic link library file of at least two CPU architecture;Also include processing module, matching module and load-on module;
Processing module is used for:
Android application is accessed third party software development kit;
Assert catalogue from Android applies copies the correlative code of third party software development kit and configuration file in the internal directory in Android application to, and generates the release directory with third party software development kit as title;
From mobile device, obtain the first CPU architecture information, from the mount message of Android application, obtain the second CPU architecture information that Android application is supported;
Matching module is used for:
By comparison match, third party software development kit is chosen the dynamic link library file that optimum CPU architecture is corresponding, and the assert catalogue from Android applies copies the library directory in the release directory to dynamic link library corresponding for optimum CPU architecture;
Load-on module is used for:
Utilize the code under dexclassloader dynamic load the release directory and dynamic link library file, and version information is write in configuration file.
The method and apparatus that above-mentioned Android application hot repair is multiple, can be in unknown host's application runtime environment on the premise of CPU architecture, automatically identify the CPU architecture in the most adaptive host's application runtime environment, and complete hot repair function, also the release directory can also be controlled and switch simultaneously.
Detailed description of the invention:
For illustrating thought and the purpose of the present invention, below in conjunction with the drawings and specific embodiments, the present invention is described further.
Fig. 1 is the multiple method flow diagram of the Android application hot repair that first embodiment of the invention provides.The method includes below step:
Wherein, third party software development kit can be some by software engineer for setting up the set of the developing instrument of application software for specific software kit, software frame, hardware platform, operating system etc..In the present embodiment, the third party software development kit of indication includes the Dynamic link library library file that conventional several CPU architecture are different, and the CPU architecture that wherein Dynamic link library library file is suitable for comprises but is not limited only to the framework such as 32 series, 64 series, arm and x86 series.
S101:Android application accesses third party software development kit
S102: in the assert catalogue from described Android applies, the correlative code of third party software development kit and configuration file are copied in the internal directory in Android application, and generate with the release directory.Correlative code refers to be capable of the core code that Android application hot repair is multiple
S103: obtain the first CPU architecture information of mobile device and obtain the second CPU architecture information that Android application is supported;
After android system 5.0 version updating, android system can be an application is installed when, the information about CPU architecture of dynamic link library file Android application provided preserves in the application, the second CPU architecture information that step S103 is mentioned.If the first CPU architecture information might not be mated completely with the second CPU architecture information, but most suitable or immediate CPU architecture information.
S104: pass through comparison match, in third party software development kit, choose the dynamic link library file that optimum CPU architecture is corresponding, and the assert catalogue from Android applies copies the library directory in the release directory to dynamic link library corresponding for optimum CPU architecture;
By the first CPU architecture information, the second CPU architecture information are mated with the Integrated comparative of third party software development kit, draw a most suitable CPU architecture information, and in third party software development kit, dynamic link library file corresponding for this most suitable CPU architecture information is copied in library directory.
If this Android application does not use dynamic link library, then then directly by with obtain the first CPU architecture information drawn on the mobile apparatus and compare to mate and draw most suitable CPU architecture information.
S105: utilize the code under dexclassloader dynamic load the release directory and dynamic link library file, and version information is write in configuration file.
Android in the present embodiment applies hot restorative procedure to be possible not only to realize completing hot repair function under the Android application premise not issuing redaction, the more important thing is can be on the premise of the CPU architecture information of unknown host, mobile device that adaptive various CPU architecture differ and reach the function that hot repair is multiple, solving current hot repair again can not problem in the mobile device that CPU architecture is different.
Fig. 2 is the multiple method flow diagram of the Android application hot repair that second embodiment of the invention provides, and the present embodiment is based on above-mentioned first embodiment, and the method also includes:
S201: judge that Android application runs the most for the first time,
If it is, perform S203;If it is not, then perform S207.
Because android system can be an application is installed when, the information about CPU architecture of dynamic link library file Android application provided preserves in the application, so when Android application is not to run for the first time when, in corresponding android system, certain record has relevant information.That is the Android application that secondary runs can utilize its relevant information kept to operate, and can reach to save the effect of part unnecessary operations.If Android application is to run on the mobile apparatus for the first time, follow-up action is identical with the first embodiment in the present invention.
S207: check the quantity of the release directory in internal directory;
If the quantity of the release directory is more than 1, perform S210 and (first read configuration file, corresponding the release directory code, and more new configuration file is loaded according to configuration information), then perform S211: judge whether whether configuration information mate with the release directory;If coupling, performing S206, if do not mated, performing S212 (select up-to-date the release directory code to load, and more new configuration file);Finally perform S206.
If the quantity of the release directory is equal to 1, performs S209 (being loaded directly into the code of this release directory, and more new configuration file), then perform S206.
While Android application needs to constantly update, third party software development kit exists too needs more news, if not in time the content of third party software development kit is updated, then it is likely to result in its service cannot normally provide, in order to preferably provide hot repair taking another dose to be engaged in, after utilizing dexclassloader dynamic load to complete loading action, we also need to that the content of third party software development kit carries out detection and update.
The further part of the multiple method flow diagram of Android application hot repair provided for second embodiment of the invention as described in Figure 3, the method also includes:
S213: judge whether third party software development kit exists redaction;
If it is, load up-to-date third party software development kit to internal directory, and generate new the release directory;Otherwise continue to run with Android application.
S216: judge that up-to-date third party software development kit is the most complete;If it is, new version information be recorded in configuration file;Otherwise it is deleted and re-starts loading.
S219: judge that whether the quantity of the release directory is more than three;If quantity is more than three, then the time sequencing created according to the release directory, delete establishment time the release directory the earliest successively;If quantity is not more than three, then continue to run with Android application.
The present embodiment utilize the release directory the third party software development kit that hot repair is multiple is controlled and switches, effectively prevent because the reason such as network state or loading procedure interruption suddenly causes file bag to damage, automatically damage file can be deleted and reloaded, greatly improve the Consumer's Experience sense of application program.On the other hand, by the third party software development kit of legacy version is carried out periodic cleaning, efficiently solve the problem that Android application is the most too fat to move.
Fig. 4 is the multiple apparatus structure schematic diagram of the Android application hot repair that first embodiment of the invention provides, and this device includes processing module 301, matching module 302, load-on module 303 and detection module 304.Preferably, detection module 304 includes first detection module, the second detection module, the 3rd detection module, the 4th detection module, the 5th detection module and the 6th detection module.
The device that in the present embodiment, Android application hot repair is multiple, including third party software development kit, third party software developing instrument includes the mutually different dynamic link library file of at least two CPU architecture;Also include processing module 301, matching module 302 and load-on module 303;
Processing module 301 is used for:
Android application is accessed third party software development kit;
Assert catalogue from Android applies copies the correlative code of third party software development kit and configuration file in the internal directory in Android application to, and generates the release directory with third party software development kit as title;
From mobile device, obtain the first CPU architecture information, from the mount message of Android application, obtain the second CPU architecture information that Android application is supported;
Matching module 302 is used for:
By comparison match, third party software development kit is chosen the dynamic link library file that optimum CPU architecture is corresponding, and the assert catalogue from Android applies copies the library directory in the release directory to dynamic link library corresponding for optimum CPU architecture;
Load-on module 303 is used for:
Utilize the code under dexclassloader dynamic load the release directory and dynamic link library file, and version information is write in configuration file.
Wherein, first detection module is used for detecting Android application and runs the most on the mobile apparatus, and the second detection module is for detecting the quantity of the release directory in internal directory;
If Android application is to run on the mobile apparatus for the first time, then perform processing module, matching module and load-on module;If Android application is not to run for the first time, then perform the second detection module;
If the quantity of the release directory is one, the release directory number of current third party SDK be recorded configuration file, then perform load-on module;The when that the quantity of the release directory being more than one, load corresponding release content according to the third party software development kit version number information of configuration file record, then perform load-on module.
The device that in the present embodiment, Android application hot repair is multiple also includes that the 3rd detection module, the 3rd detection module are used for detecting and judges whether configuration file message matches with the release directory, if it does, then perform load-on module;If it does not match, select up-to-date the release directory code to load, and more new configuration file, then perform load-on module.
The device that in the present embodiment, Android application hot repair is multiple also includes that the 3rd detection module, the 3rd detection module are used for detecting whether third party software development kit exists redaction;If third party software development kit exists redaction, then load up-to-date third party software development kit to internal directory, and generate new the release directory;Android application is then continued to run with if there is no redaction.
The device that in the present embodiment, Android application hot repair is multiple also includes the 4th detection module, and the 4th detection module is for detecting up-to-date third party software development kit;If complete, then new version information be recorded in configuration file;If imperfect, then it be deleted and re-start loading.
The device that in the present embodiment, Android application hot repair is multiple also includes the 5th detection module, and whether the 5th detection module is for detecting the quantity of the release directory of third party software development kit more than three;If quantity is more than three, then the time sequencing created according to the release directory, delete establishment time the release directory the earliest successively;If quantity is not more than three, then continue to run with Android application.
Above-described embodiment, simply to illustrate that the design of this technology and feature, its objective is to be to allow those skilled in the art will appreciate that present disclosure and to implement according to this, can not limit the scope of the invention with this.Every change according to the equivalence done by the essence of present invention or modification, all should contain within the scope of the present invention.