Explain in detail the method of correctly introducing so files in Android studio

I believe many friends have encountered the problem of how to introduce third-party so files when developing with Android studio. However, the third-party official only gives the integration mode under the ADT environment. Android studio uses gradle compilation by default, which is different from ADT editing. How should so files be introduced?

It's actually very simple. Here, take the integration of jpush as an example to see how the so file is introduced into the compilation environment. Finally, the so file can be called directly to JNI.

First, create the LIBS directory in the root directory of our module and copy the so files in the jpush integration SDK respectively. The screenshot is as follows:

Then write our build. Gradle file.

The configuration introduced by so file is very simple. The code configuration is as follows:

Customize a task and specify the directory of so files that the project depends on. Here * * / *. So is used. To save trouble, specify the directory to be copied into into "lib", and the dynamic runtime will be copied into the Lib directory.

The complete build.gradle file is as follows:

Based on someone's questions in the comment area, here's a faster and lighter configuration method

In the build.gradle configuration, configure the following information:

Your so package can be placed in the Lib directory in the same directory as the jar package, such as lib / armeabi / libjpush172.so.

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