What are .tflite files in app bundles and how to remove them

My mobile app is written in React Native and built using Expo as a bundle, then uploaded to Google Play .

Google Play Console warns me about size of the bundle and hints on removing largest files that are these:

  • assets/models/fssd_100_8bit_gray_v1.tflite (2.49 MB)
  • assets/models/fssd_100_8bit_v1.tflite (2.45 MB)
  • assets/models/contours.tfl (1.16 MB)

Does anyone know what these files are and how to remove them from my app bundle? Google tells me that .tflite is for Tensor Flow Lite, but I am sure I am not using it.

I believe they’re used by the face detector which is one of the things included in Expo.

There’s a feature request that is being worked on to reduce app size:

Brent Vatne marked this post as IN PROGRESS

we’ve been working on refactoring expo sdk such that we can pick which apis we want to include/exclude, this is in a good spot now and our next step is to migrate all of our apis to this architecture, and then we need to add support for this to our build service. no eta yet but this is well underway

July 24, 2018

Brent Vatne

we recently changed standalone app builds so they only include the sdk version you use at the time of building, this reduced the android app size from i believe about 27mb to 19mb or so, unsure about the impact on the ios side at the moment. we’ll keep working on making it possible to opt out of specific apis to further reduce the size

October 31, 2018

But since those models are just data files and they shouldn’t be needed if you’re not using the face detector, I suppose it should be possible to exclude them/remove them from the APK/app bundle. But if you remove them from an existing app bundle I think the bundle would need to be signed again.

The following article explains some stuff about how to build app bundles yourself (the article is talking about building any Android apps, not specifically Expo apps):

If you can figure out how to sign the app bundle without building it from scratch you could perhaps try removing the model assets, re-sign the app bundle and see if it still works as expected.

Otherwise I think the only feasible option until the above feature request is implemented is to eject and remove the face detector module.