Reputation: 7913
I have an Android studio project that is made of several sub-projects, which are all android apps. It is setup like this:
Project
|---- Main app
|---- Other app 1
|---- Other app 2
|---- Other app 3
|---- etc.
The point is that all the "other app" sub-projects need to be included in the Main app final APK (they are plugins that the Main App can install on-demand when/if the user requests them).
So what I need is to setup the project so that:
Now, I'm used to Visual Studio, and there I can just set up project dependencies so that building one project triggers a build of the other projects, and I can set a post-build command that copies the generated binary to another folder quite easily.
With Android Studio and Gradle however I'm getting extremely confused.
First of all: even if I setup the project so that Main App depends on all the Other Apps this doesn't build the Other Apps' APKs, it only compiles their sourcecode (which is useless in my case, I need the final APK of the Other Apps).
Secondly, assuming I've been able to generate such APKs, I can't find a place where to setup a post-apk-generation command to copy those apks to another directory. I've been reading about gradle tasks and the "dependsOn" feature, however from what I understand the task that generates the actual APK ("assemble") is the last one in the build chain, so using dependsOn is no use to me, I would need something like "whenFinishedRun(myTaskThatCopiesTheAPKs)"
Any easy way to do this? Maybe it's because I'm a Gradle noobie, but this build system seems extremely convoluted to me, I'm actually thinking of writing an external program to run mamually to accomplish these tasks...
Upvotes: 0
Views: 195
Reputation: 6289
Rather than operating on the APK, gradle dependencies let you config an AAR dependency that can help with your issue.
Example dependency on aar here - see "amlcurran"
Upvotes: 1