CN103455337A - Method for using dynamic library under Android development environment - Google Patents

Method for using dynamic library under Android development environment Download PDF

Info

Publication number
CN103455337A
CN103455337A CN2013104142149A CN201310414214A CN103455337A CN 103455337 A CN103455337 A CN 103455337A CN 2013104142149 A CN2013104142149 A CN 2013104142149A CN 201310414214 A CN201310414214 A CN 201310414214A CN 103455337 A CN103455337 A CN 103455337A
Authority
CN
China
Prior art keywords
dynamic base
android
path
header file
dynamic library
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.)
Pending
Application number
CN2013104142149A
Other languages
Chinese (zh)
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.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric Co Ltd
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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN2013104142149A priority Critical patent/CN103455337A/en
Publication of CN103455337A publication Critical patent/CN103455337A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to a method for using a dynamic library under an Android development environment. The method comprises the followings: a, a dynamic library and the corresponding path of the header file of the dynamic library are configured; b, configuration information containing the library name of the dynamic library is added into an Android system configuration file using the dynamic library in a project; c, the dynamic library is used, the absolute path of the header file of the dynamic library is obtained through the path of the header file of the dynamic library, configured in the step a, and the absolute path is added into the variable of an Android compilation system; d, during the compiling and code developing of the Android compilation system, the header file of the dynamic library in the variable of the step c can be sought automatically. The method provided by the invention can reduce the repeated labor of a developer greatly, the labor intensity of the developer can be reduced remarkably, the developing steps are simplified, and the probability of errors during the repeated labor can be effectively reduced.

Description

Use the method for dynamic base under the Android development environment
Technical field
The present invention relates to the program application process under the Android development environment, is the method for dynamic base of using under the Android development environment concretely.
Background technology
NDK is the Android(Android) kit set that system provides, NDK makes the Android program developer can use local code language development Android program, as: C, C++ etc.
Because having had a lot of useful dynamic link libraries (.so storehouse), C, C++ etc. provides abundant function, in order to save the software development time, improve the reusability of software development efficiency and existing code, when exploitation NDK local code, use dynamic link library just unavoidable.In the NDK exploitation, use dynamic link library mainly to rely on the support of NDK to the precompile storehouse at present, the use procedure more complicated is loaded down with trivial details, illustrate its concrete step of using: the name of supposing the dynamic link library that is used is test.so, the header file of the dynamic base be used is test.h, and the engineering of projectA by name can be used dynamic base test.so.At first need to be under the jni of projectA catalogue a newly-built catalogue newDir who deposits test.so, test.so and test.h are copied under newly-built catalogue newDir, and under newly-built catalogue newly-built corresponding Android.mk file, then in the Android.mk file under the jni of projectA catalogue, add to use the parameter of dynamic link library.If there are several engineerings all will use the test.so storehouse, in the engineering in several uses test.so storehouse, all needed above step.Clearly, such step and mode can constantly repeat in a plurality of engineerings, increased developer's mining inetesity, and also increased the probability of makeing mistakes when carrying out repeatedly same operation.In large-scale development project, this drawback seems particularly outstanding especially.
Summary of the invention
The invention provides a kind of method of using dynamic base under the Android development environment, the path by the mode of reusing to dynamic base only once configures, and to reduce the duplication of labour, reduces the probability of makeing mistakes.
The present invention uses the method for dynamic base under the Android development environment, comprising:
A. configure the respective paths of dynamic base and dynamic base header file;
B. add the configuration information of the library name that comprises dynamic base in the Android system configuration file in the engineering of using dynamic base;
C. apply dynamic base, the path of the dynamic base header file configured by step a obtains the absolute path of dynamic base header file, and described absolute path is added in the variable of Android compiling system;
D. the Android compiling system, when the compiling exploitation code, finds the dynamic base header file automatically in the described variable of step c.
Do not need like this dynamic base is copied under each catalogue of using engineering, need to be in the newly-built corresponding configuration file of each engineering input configuration information yet, but also to revise the original configuration file of NDK.The developer only need to configure the dynamic base routing information simply, and in will using the original configuration file of dynamic base engineering, the dynamic library name of simple interpolation just can have been used dynamic base easily in all engineerings.Greatly simplify the process that the developer uses dynamic base, improved development efficiency.This mode is applied in the development environment of frame-type and also can plays standardization and unitized effect.
Concrete, the path described in step a is the relative path with respect to the NDK root directory of Android system.
Further, if current operating system is Windows operating system, after the absolute path obtained in step c is changed to the absolute path of Windows system identification form by script, then add in the variable of Android compiling system.
Concrete, in step c, be that the absolute path of dynamic base header file is added in the LOCAL_LDLIBS variable of Android compiling system.
Further again, also to the absolute path of dynamic base header file be added in the LOCAL_C_INCLUDES variable of Android compiling system in step c being.
Method of the present invention has significantly reduced developer's the duplication of labour, has obviously reduced developer's labour intensity, has simplified development procedure, has very effectively reduced the probability of makeing mistakes due to the duplication of labour.
Below in conjunction with the embodiment of embodiment, foregoing of the present invention is described in further detail again.But this should be interpreted as to the scope of the above-mentioned theme of the present invention only limits to following example.Without departing from the idea case in the present invention described above, various replacements or the change according to ordinary skill knowledge and customary means, made, all should comprise within the scope of the invention.
The accompanying drawing explanation
Fig. 1 is that the present invention uses the process flow diagram of the method for dynamic base under the Android development environment.
Embodiment
The present invention uses the method for dynamic base under the Android development environment as shown in Figure 1, comprising:
A. configure the relative path of the root directory of the NDK with respect to Android system of dynamic base and dynamic base header file;
B. find the Android.mk configuration file in the jni catalogue of the engineering of using dynamic base, add the configuration information of the library name that comprises dynamic base in this configuration file: " LOCAL_LDLIBS:=-l library name ", wherein library name partly need to be removed " .so ", for example dynamically library name is test.so, and the library name of-l back is exactly test.If comprised " LOCAL_LDLIBS " variable in configuration file, can directly after the existing library name of variable, add " l library name ";
C. apply dynamic base, the relative path of the dynamic base header file configured by step a obtains the absolute path of dynamic base header file, if current operating system is Windows operating system, the absolute path obtained in step c is changed to the absolute path of Windows system identification form and described absolute path added in the variable of Android compiling system by script;
D. the Android compiling system, when the compiling exploitation code, finds the dynamic base header file automatically in the described variable of step c.
Take concrete engineering as example:
At first revise " build/core/import-locals.mk " compiling file of the compiling system of NDK.Then the first step, used the awk script from the dynamic base configuration file configured, and obtains dynamic base and the dynamic base header file relative path with respect to NDK.Second step, the relative path of the dynamic base got by the first step adds the path of NDK root directory, obtains the absolute path of dynamic base.If under Windows operating system, also need absolute path is converted to by the awk script absolute path of Windows form.Then absolute path is added in " LOCAL_LDLIBS " variable of NDK compiling system, addition manner is " LOCAL_LDLIBS+=-L path ".The 3rd step, the relative path of the dynamic base header file got by the first step adds the path of NDK root directory, obtains the absolute path of dynamic base header file.Same, if corresponding under Windows operating system, also need absolute path is converted to by the awk script absolute path of Windows form.Then absolute path is added in " LOCAL_C_INCLUDES " variable of NDK compiling system, addition manner is " LOCAL_C_INCLUDES+=path ".The 4th step when using NDK compiling system compiling developer's code, can be automatically finds dynamic base in the path that LOCAL_LDLIBS variable and LOCAL_C_INCLUDES variable comprise.

Claims (5)

1. use the method for dynamic base under the Android development environment, its feature comprises:
A. configure the respective paths of dynamic base and dynamic base header file;
B. add the configuration information of the library name that comprises dynamic base in the Android system configuration file in the engineering of using dynamic base;
C. apply dynamic base, the path of the dynamic base header file configured by step a obtains the absolute path of dynamic base header file, and described absolute path is added in the variable of Android compiling system;
D. the Android compiling system, when the compiling exploitation code, finds the dynamic base header file automatically in the described variable of step c.
2. the method for claim 1 is characterized by: the path described in step a is the relative path of the NDK root directory with respect to Android system.
3. the method for claim 1, it is characterized by: if current operating system is Windows operating system, after the absolute path obtained in step c is changed to the absolute path of Windows system identification form by script, then add in the variable of Android compiling system.
4. method as described as one of claims 1 to 3, is characterized by: in step c, be that the absolute path of dynamic base header file is added in the LOCAL_LDLIBS variable of Android compiling system.
5. method as described as one of claims 1 to 3, is characterized by: in step c, be that the absolute path of dynamic base header file is added in the LOCAL_C_INCLUDES variable of Android compiling system.
CN2013104142149A 2013-09-12 2013-09-12 Method for using dynamic library under Android development environment Pending CN103455337A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2013104142149A CN103455337A (en) 2013-09-12 2013-09-12 Method for using dynamic library under Android development environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2013104142149A CN103455337A (en) 2013-09-12 2013-09-12 Method for using dynamic library under Android development environment

Publications (1)

Publication Number Publication Date
CN103455337A true CN103455337A (en) 2013-12-18

Family

ID=49737744

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2013104142149A Pending CN103455337A (en) 2013-09-12 2013-09-12 Method for using dynamic library under Android development environment

Country Status (1)

Country Link
CN (1) CN103455337A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975859A (en) * 2015-12-29 2016-09-28 武汉安天信息技术有限责任公司 Method and system for auxiliary analysis of malicious code
CN106484490A (en) * 2015-09-02 2017-03-08 腾讯科技(深圳)有限公司 A kind of trace analysises method and apparatus of application program
CN106897080A (en) * 2015-12-18 2017-06-27 北京国双科技有限公司 The processing method and processing device of dynamic link library
CN109471797A (en) * 2018-10-23 2019-03-15 深圳市佰仟金融服务有限公司 A kind of environment configurations management method, system and terminal device
CN111506357A (en) * 2020-02-27 2020-08-07 湖南大学 Automatic dynamic library loading method, system and application

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008136508A1 (en) * 2007-05-07 2008-11-13 Ize Co., Ltd. Development system, server of development system, and development method
CN101571801A (en) * 2008-04-28 2009-11-04 鸿富锦精密工业(深圳)有限公司 Service expansion system and method
CN101697135A (en) * 2009-10-28 2010-04-21 北京东方网力科技有限公司 Method and device for compiling program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008136508A1 (en) * 2007-05-07 2008-11-13 Ize Co., Ltd. Development system, server of development system, and development method
CN101571801A (en) * 2008-04-28 2009-11-04 鸿富锦精密工业(深圳)有限公司 Service expansion system and method
CN101697135A (en) * 2009-10-28 2010-04-21 北京东方网力科技有限公司 Method and device for compiling program

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106484490A (en) * 2015-09-02 2017-03-08 腾讯科技(深圳)有限公司 A kind of trace analysises method and apparatus of application program
CN106897080A (en) * 2015-12-18 2017-06-27 北京国双科技有限公司 The processing method and processing device of dynamic link library
CN106897080B (en) * 2015-12-18 2020-05-01 北京国双科技有限公司 Processing method and device of dynamic link library
CN105975859A (en) * 2015-12-29 2016-09-28 武汉安天信息技术有限责任公司 Method and system for auxiliary analysis of malicious code
CN105975859B (en) * 2015-12-29 2019-04-16 武汉安天信息技术有限责任公司 A kind of method and system of assistant analysis malicious code
CN109471797A (en) * 2018-10-23 2019-03-15 深圳市佰仟金融服务有限公司 A kind of environment configurations management method, system and terminal device
CN111506357A (en) * 2020-02-27 2020-08-07 湖南大学 Automatic dynamic library loading method, system and application

Similar Documents

Publication Publication Date Title
CN107908403A (en) A kind of collocation method and system of the modularization of mobile terminal business module
US7739696B2 (en) Message translation systems and methods
CN106933609B (en) Android application program installation package generation method and device
CN103455337A (en) Method for using dynamic library under Android development environment
CN109388566A (en) A kind of code coverage rate analysis method, apparatus, equipment and storage medium
CN105630488A (en) Docker container technology-based continuous integration realizing method
CN106843837A (en) The construction method of openstack assembly containers
CN104932905A (en) Automatic code generation method from AADL to C language
CN106325965B (en) The Compilation Method and device of operating system
CN109144533A (en) A kind of method, system and the computer installation of update and the load of application program
CN104536737A (en) Program development framework based on assemblies
CN101980546B (en) Intelligent network platform, service execution method and method for analyzing service abnormality
CN110928531A (en) Electromagnetic spectrum monitoring system software platform construction method
CN104331315A (en) Analysis and generation method and system of json object of any level
CN110825386A (en) Code compiling method and device and storage medium
CN104793954A (en) Compiling-free graphical combined element encapsulating and reusing method
CN109871241A (en) A kind of configuration method of Cross-environment application server
CN105260169A (en) Cross-platform python program transplanting method and device
CN113220283A (en) Internet of things APP development system based on cloud arrangement
CN112631600A (en) Software construction method and system based on Flutter
CN107179903B (en) System and method for developing mobile-based applications using model-driven development
CN116974620A (en) Application program generation method, operation method and corresponding device
CN106445611B (en) Big data node system and automatic deployment method
CN110109684B (en) Block chain link point management proxy service installation method, electronic device and storage medium
US10579366B2 (en) Data upgrade framework for distributed systems

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20131218

RJ01 Rejection of invention patent application after publication