Android.mk introduces third-party jar packages and so library files

Take systemui as an example. If you need to introduce a third-party jar package and so library into systemui, you can do the following:

First, create a new LIBS directory under frameworks \ base \ packages \ systemui:

Place the jar package to be imported into the LIBS directory. Then modify the android.mk file:

In other words, the introduction of jar packages mainly depends on local_ PREBUILT_ STATIC_ JAVA_ Libraries and local_ STATIC_ JAVA_ LIBRARIES。 Next, post the complete android.mk for easy copying.

We put the jar package to be imported into the LIBS directory under the systemui, and completed its introduction by modifying android.mk. So what about the so library? It doesn't say where to put it?

In Android, after system level apps use the so library, they will go to the system / lib directory to find it, so you only need to put the so Library in the system / lib directory, and then pass local in android.mk_ SHARED_ The libraries variable can be referenced. We can push the so library to the system / lib directory of the device through ADB, but what if we want to copy the so library to the system / lib directory during Android system compilation? This uses the product in the Android compiler system_ COPY_ Files variable.

For example, open a. MK file named after a product in the device \ XX \ XXX directory and search for product_ COPY_ You can see many use cases of the files variable, such as:

PRODUCT_ COPY_ Each value of files is separated by ":", followed by the source and the destination. For example, we create a new lib directory in the devices / XX / xxx directory, place libtest1.so and libtest2.so in the Lib directory, and then we can_ COPY_ Files is assigned the following value, that is, the system will copy them when compiling:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>