Explain in detail how Android studio imports third-party class libraries, jar packages and so libraries

Third party class library source code

When I transferred a netizen's XMPP code from ADT to as, I found that it used a third-party class library. The source code was placed under lib and imported project directly in as. The third-party class library was not imported automatically. It seems that I need to do it myself.

The directory structure of the project is as follows:

Copy the third-party source code qqemoji lib to this directory, modify settings.gradle and add this lib:

Modify build.gradle under app and add in dependencies:

Create a new build.gradle file under qqemoji lib. The contents are as follows:

Please refer to the last second link for the configuration of gradle.

The structure of the project is shown in the following figure:

At this time, the compilation is passed and the import is successful!

Third party class library jar package

This is much simpler. Directly copy the jar package to app / LIBS, and then add the dependency of this jar in build.gradle under app. As follows:

Third party so Library

Generally speaking, we don't need extra work to call the so Library of a third party. We just need to put it into the specified directory and load it in the java file.

For example, I quote libfirstlib.so compiled in the first NDK program before, put it under app / SRC / main / jnilibs / armeabi / and quote it in the source code:

Just. The program runs as follows:

reference resources:

http://www.cnblogs.com/neozhu/p/3458759.html http://www.open-open.com/lib/view/open1415793464648.html

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
分享
二维码
< <上一篇
下一篇>>