2

I am trying to deploy my first instant app, but keep getting this error on the google play console that keeps the 'Deploy' button disabled:

Your Instant App APKs contains an APK that is greater than the maximum size of 4364793 bytes

while the android studio APK profiler tools shows:

raw size: 3.5 MB

Download size: 3.5 MB

APK size: 3.8 MB

Further more, I noticed that the maximum size kept decreasing as I reduced the APK's size(it was initially 4.2 MB)

I would like to get help if someone has a clue on what is going wrong.

Community
  • 1
  • 1
al kaj
  • 119
  • 1
  • 9

2 Answers2

2

I was a little thrown off by the message "APK contains an APK", thinking that you might have some exotic app. But I don't see that string in the publishing code, so I think you're running into a more typical error.

The Instant App format is a ZIP file containing APKs. Each of these APKs must be under 4MB.

Additionally, if your app is split up into feature APKs and a base APK, then any combination of feature + base must also be under 4MB.

If you use configuration APKs, then those also contribute to the limit, but I don't think you are.

Off the top of my head, I'm not sure what APK Profiler is telling you for instant apps, whether it's the size of the whole ZIP, or of a single APK. I could be wrong, but I don't think it knows about the calculation of our 4MB limit. One easy way to check the sizes without using any fancy tools is to just unzip the ZIP file and look at the sizes of the APKs on disk. Or use APK Analyzer.

One other thing: if you publish to dev track, there are no size restrictions there. Not that that solves your size problem, but it can be a useful way to play around with Instant Apps before tackling the size problem.

Source: Instant Apps FAQs: App size.

philo
  • 3,580
  • 3
  • 29
  • 40
  • Thank you for your answer, I just copy paste the error message though, anyway I just figured out that the APK profiler were not considering the sizing as the google play console does, there is like 600Ko difference so I did more reduction but still had an error because I did not mention the point **Additionally, if your app is split up into feature APKs and a base APK, then any combination of feature + base must also be under 4MB** so thank you very much!!! – al kaj Nov 27 '17 at 03:39
  • What is a configuration APK? – dazza5000 Nov 27 '17 at 14:53
  • @dazza5000 https://developer.android.com/topic/instant-apps/guides/config-splits.html – philo Nov 28 '17 at 15:11
  • @alkaj, you said you copied and pasted the exact string that you saw. I'd like to fix the bad wording. But I'm seeing a slightly different string, and I'd like to check whether this is what you saw: "Your Instant App APKs contains an APK that is greater than the maximum size of 4364793 bytes". – philo Nov 28 '17 at 23:57
  • @philo certainly, because when I said I copy pasted, it was the message in french into the translator, I'll edit my question then, thank you for pointing it out. – al kaj Nov 30 '17 at 02:31
  • Got it. Thanks for clarifying. I'll see about getting that message fixed. – philo Nov 30 '17 at 02:37
0

4MB is the designated size limit of Instant Apps in Android as stated in the documentation:

You must be mindful of the 4MB size limit for instant app downloads. Also, each feature needs to have a single activity as its entry point.

What I can suggest is that check the Reduce APK Size docs. Its suggests removing unused resources, minimize resource use m libraries and so much more.

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56