How can I upload APK bigger than 100mb? (simplified) - android

I've built an app using react native augmented reality app where the filters are located in the android app's assets folder but together those filters take up about 60mb or so, so when I build an APK from it, it always end up being bigger than 100mb. I've tried minifying it with proguard, getting rid of any unnecessary code and node_modules ... etc but it's just outright impossible to downsize the APK to be less than 100mb.
What are the ways of uploading it? I've looked online and people recommended that i need to create separate the android assets in expansion files. But what even are expansion files? and how do I create them? There are no clear instructions or guidelines that explain the fundamentals nor practicals.

Look into Play Asset Delivery (https://developer.android.com/guide/app-bundle/asset-delivery). This solution has replaced the painful use of expansion files and allows to serve assets only when needed.
It can also make the download of your app faster by allowing the assets to be downloaded separately from the base of your app.

Related

Android .AAB file + PAD cannot be uploaded to Google Play

I am building an app using React Native that involves the use of many assets (specifically .mp4 files).
My app is around 430mb.
On the Android side, I have followed the Play Asset Delivery official documentation, and I cannot get it to work.
I am only using install_time assets, and therefore have not used the Play Core API. After setting everything up (as per the documentation), I generate a Signed Bundle, and try to upload it for internal testing on Google Play Console, only to get an error back because of my bundle size being larger than 150mb.
I cannot find anything online about this, as there are no tutorials or helpful documents yet, and everything I have found has been Unity related, which I am not using.
I currently have a module for the install_time_asset_pack, and a AndroidManifest.xml was generated when I built my app. That being said the bundle is still above 150mb and the Play Console does not seem to split the encapsulated .APK file and the PAD when I try to upload.
Does anyone know anything about this? Or can someone point me to an actually helpful tutorial to implement PAD? Preferably not unity related please.
Thanks!
EDIT:
So it seems the APK generated in my .aab file (the base folder) was larger than 150mb. It seemed to also keep the assets I split into the asset-packs, and thats why it had the large size. So I unzipped the .aab, removed those, and now I don't know how to zip the .aab together again. Any thoughts?

Is is possible to package non-standard files in APK without assets?

I am trying to package /somewhere/lib/python3.x inside APK's lib folder like jniLibs. But it contains *.py, *.pyc and other files. I have asked another question, but there is no answer. So this is a general question: do you ever used or developed any plugins that embed non-standard files in APK instead of using assets?
How would you access those files? I mean you could put them in the apk, an apk is just a zip file. But the system won't unpack them for you, and at runtime you won't be able to access the apk file itself (installation unzips your file and deletes the apk). You might be able to fool it into doing so by putting it with the jni libs and hoping it doesn't look at extention, but it seem like a bad idea.
However its not uncommon for an app to take its assets and write them to the filesystem on first boot. In fact its fairly common to do this with updatable assets (you'd then just download new versions on top of them, but you can use the old versions to not need an immediate network connection). This would probably work for you. Just make your initial activity a splash screen, and have it do the copy from assets to files in the background while the splash is up.

Size Limit of Android Application that can be installed as APK

I am currently on an Android project which contains Videos/Audios and many Images. All these media files are in res/drawable or res/raw or in the assets directory of android project. When I build APK its size reached 300MBs and I haven't complete 50% of the project yet. Although project will not be uploaded on Google Play Store It will be installed as it is. I am concern about the size of APK it will reach. Can you tell me what is the size limit of the APK that can be installed on an Android device. Thanks.
There is no size limit, but Google play has a limit of 150mb and .aab files that exceed this limit cannot be uploaded as a normal build instead you have to use feature delivery.
You say that you are not going to upload to playstore; still 300mb is huge and cannot be justified.
Use code obfuscation techniques to remove unwanted code and resources.
Avoid hardcoding / adding huge resource files with the package. i.e., images and videos. Instead, if possible, make them load from a backend like Firestore.
Avoid usage of libraries even for menial tasks ( if you are doing that )
In conclusion, 300 mb is huge. Man, bring it down below 100 mb at least.

Duplicating offline OSMdroid app resource files?

I am currently developing an offline app with OSMDroid and I'm starting to ask myself some questions about the storage space the app is going to take.
Previously we had the MBTiles and the database stored at the root of the internal memory and we installed it apart from the app, but we judged it insecure and inconveniant.
Now, the files are compiled with the app and are installed on start-up in the private folder of the app itself.
Here's my question, does it mean that technically both files are duplicated because there is one version compiled in the app and one in the internal memory, thus taking more storage space?
Is there a better solution for this?
After multiple attempts to find a standard way to not duplicate the resources files, I found that I will have to use expansion files.
According to https://developer.android.com/google/play/expansion-files.html, APK files may not exceed 100MB, after that limit you have to use expansion files that will be downloaded with the installer from the play store.
Expansion files are already in a reachable location for OSMdroid so no need to copy them in the app's private folder.
However since my app might be for a restricted-public only and installation will be done manually, I thought of building a separate app that will install the app + expansion files to give less hassle to my clients.

Packaging large database with android

I'm looking to packing a large sqlite database with an android app, about 200-300MB. From what I've read, my options are putting it in the assets folder, and coping it out at runtime, resulting in duplicate data, or downloading the database from the web at runtime. I don't want to create a webserver for this app, so I was thinking of creating a seperate app that just installs the database to get around the data duplication problem.
All of those are pretty crummy, and I was wondering if there is a better solution?
First, I don't think you are allowed to put a 200-300MB database in your assets folder and distribute it as a single apk, since the hard limit for an apk file size is (as per google's documentation) 50 MB and I doubt that your db will compress that far.. Google introduced the "APK expansion files" for packaging large files with your apk. You can read all about those here: http://developer.android.com/google/play/expansion-files.html
I think (but I have no experience with expansion files myself) that this will not fix the issue you mentioned about having to deal with duplicate data because of the requirement to copy out your database file, but at least this will help you in the sense that you won't have to host your database file on your own webserver. I quickly scanned the documentation on the link I gave above and it clearly states that you should NOT throw away the expansion files when you are done with them, so no help on that part.
Of course, for the "setting up your own webserver part": I wouldn't even bother setting up my own webserver. There are plenty of parties out there that provide you some file hosting service. Probably you will have to pay for the bandwidth, but hey.. if people download your db file a lot, that also means that your app is doing well ;-)
I test of apk expansion files. I created a test app with a 100 MB sqlite database, uploaded the apk and database to the play store. I then downloaded the app onto the phone, the database was downloaded at the same time. The database was automatically renamed and placed in the publicly accessible directory:
/storage/sdcard0/Android/obb/com.example.app/main.1.com.example.app.obb
The app was able to open the database without any problems, but required external read and write permissions. The new and original database are bit for bit, the same. This appears to be the best solution for my use case.
A few issues, the new android developer console does not support uploading expansion files, so the old one needs to be used. Google only allows 2 expansion files, so that may be an issue for some use cases. Google say that you must not rename or delete the file, and that your app must be able to download the file from Google itself if it wasn't automatically installed.

Categories

Resources