Examples of correct reference to AAR in Android studio library module

Today, connect to an SDK monitored by Haikang. The SDK is provided in the form of AAR, and the module I need to use for this AAR is a library. Therefore, in the normal way of introducing AAR into the application module, the system will consistently report errors. First, it will prompt to close the offline, and then it will prompt an error if it is closed. Thought for a long time and didn't understand. Finally, through the guidance of the company's predecessors, AAR was correctly introduced.

1. In addition to the normal introduction of AAR, we also need to add the following paragraph in the build.gradle file of the module where the application is located:

In the application build, you should also add the file point. You can add various modules, separated by commas. The module name is your modlename.

Then correctly introduce in your own module:

This completes the introduction of AAR.

―――――――――――――― updated on January 3, 2018 ――――――――

It is best to use remote dependency, which can effectively solve the problem of multi-level dependency, resulting in duplicate library files.

The rule of remote dependency is not to pass dependency, so the re referenced modules that this module depends on are invisible:

Modules a, B, C

If B depends on C and is remotely dependent, C is invisible to a when a depends on B.

If we need to use C in a, we can rely on C in a.

Another solution:

Then when we rely on AAR in the library, we can upload the AAR to Maven warehouse or other remote addresses, so that there will be no problem that the compilation fails or cannot run when we rely on it.

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