# Adding Plugins to APK Expansion Files

**URL:** <https://forum.ionicframework.com/t/adding-plugins-to-apk-expansion-files/89577>\
**Category:** ionic-v3\
**Created:** [May 9, 2017, 10:04pm UTC](https://forum.ionicframework.com/t/adding-plugins-to-apk-expansion-files/89577 "2017-05-09T22:04:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nolemartley](https://avatars.discourse-cdn.com/v4/letter/n/50afbb/32.png) [@nolemartley](https://forum.ionicframework.com/u/nolemartley)\
**Post date:** [May 9, 2017, 10:04pm UTC](https://forum.ionicframework.com/t/adding-plugins-to-apk-expansion-files/89577/1 "2017-05-09T22:04:36Z")

</div>

I have a project with a very large cordova plugin (about 200MB). This plugin by itself adds about 110MB to the final APK that I build. Is there any way I can add this plugin to an APK expansion file?

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [May 10, 2017, 7:39am UTC](https://forum.ionicframework.com/t/adding-plugins-to-apk-expansion-files/89577/2 "2017-05-10T07:39:05Z")

</div>

There is a Cordova plugin to handle expansion files:

> **[agamemnus/cordova-plugin-xapkreader](https://github.com/agamemnus/cordova-plugin-xapkreader/tree/cordova-6.5.0)**
>
> cordova-plugin-xapkreader - Easily access Google Play APK expansion file data.

Problem will be that this is made for content, not really plugins. What does take so much space in this plugin? You probably will have to extract some things as I don’t really see a way to take the whole plugin (In the APK this isn’t this neat folder of stuff, but things all over the place most of the time).

---

<div class="post-metadata">

**Author:** ![nolemartley](https://avatars.discourse-cdn.com/v4/letter/n/50afbb/32.png) [@nolemartley](https://forum.ionicframework.com/u/nolemartley)\
**Post date:** [May 10, 2017, 12:30pm UTC](https://forum.ionicframework.com/t/adding-plugins-to-apk-expansion-files/89577/3 "2017-05-10T12:30:38Z")

</div>

Thanks for the reply.

That’s the plugin I had looked into before posting. The problem I’m having is with a pretty large asset in a custom plugin that was built for my organization (over 90MB). Fortunately, I researched the developer’s comments, and it appears that this data file will automatically be downloaded when the plugin starts for the first time if it cannot be found locally. I haven’t test this mechanism in months, but if it works, it would solve my problem since the absence of the data file would drop my APK below 100MB. Thanks again for your time.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [May 10, 2017, 2:00pm UTC](https://forum.ionicframework.com/t/adding-plugins-to-apk-expansion-files/89577/4 "2017-05-10T14:00:45Z")

</div>

Even if it doesn’t work, this Cordova plugin I posted seems to be perfect for assets - so maybe you just have to make your current plugin a bit more fault tolerant while the expansion isn’t there yet.

---

<div class="post-metadata">

**Author:** ![nolemartley](https://avatars.discourse-cdn.com/v4/letter/n/50afbb/32.png) [@nolemartley](https://forum.ionicframework.com/u/nolemartley)\
**Post date:** [May 10, 2017, 2:48pm UTC](https://forum.ionicframework.com/t/adding-plugins-to-apk-expansion-files/89577/5 "2017-05-10T14:48:40Z")

</div>

Wish I could, but I didn’t write the problematic plugin we’re using in our app. It references native android code that I don’t have the source for. The android code’s assets are the data hog.
