How to package multiple AAR's in my release aa

2019-07-18 21:24发布

问题:

We ship an android sdk (aar) file to the customer. Our code internally uses two 3rd party aar's which we have in our repo and gradle references it at run time. My question is that how do I ship these dependencies to the customer? As in if I dont want to give them those 3rd party aar's, how can I embed those two aar's within my aar. Till now we were using: https://github.com/adwiv/android-fat-aar.

This doesn't work now, so looking for parallel/better ways of solving the problem.

回答1:

I use module dependencies in the Android Studio project: right click on your project -> Open Module Settings or navigate to View -> Open Module Settings -> click on 'app' / module-name -> select 'Dependencies' tab. On the left bottom, you should find a '+' button to add library dependency/Jar dependency/module dependency. Once you click 'OK' and rebuild your project into an aar file, you will find all the dependencies included.

It automatically updates the gradle file too.