skip to Main Content

I tried to replace all the JSON lottie files in my Android project to dotLottie file format. In the project a single JSON that was around 200kb was reduced down to 20kb. So replacing around 30 such files should have reduced the APK size, right?

But after building a release APK, I found to my surprise that the APK size did not decrease. In fact, it increased by few KBs.

How can this be?

2

Answers


  1. There could be several reasons why replacing JSON Lottie files with dotLottie files did not result in a reduction in APK size. Here are a few possible explanations:

    Compression: The Lottie files in your project may already be compressed using standard compression algorithms like gzip. If this is the case, the dotLottie files may not compress as efficiently as the compressed JSON files, leading to a larger APK size.

    Overhead: The dotLottie format may introduce additional overhead compared to JSON. While the individual dotLottie files may be smaller, the overall size of the dotLottie library or runtime required to support dotLottie files could offset the savings achieved by using the smaller file format.

    Resource Optimization: The APK size is determined not only by the size of the individual files but also by how those resources are optimized during the build process. It’s possible that the build tools or processes you’re using do not optimize dotLottie files as effectively as JSON files.

    Other Dependencies: The APK size can be influenced by various factors, including the size of other dependencies or resources in your project. If the reduction in Lottie file size is relatively small compared to the overall size of your project, it may not have a significant impact on the final APK size.

    To further investigate the issue, you can try the following steps:

    Compare compression ratios: Verify whether the dotLottie files are being compressed as effectively as the JSON files. You can use compression tools or libraries to compress both file types and compare their resulting sizes.

    Analyze build artifacts: Inspect the APK contents to identify any unexpected increases in size. Look for any new dependencies or resources that might have been introduced during the conversion to dotLottie.

    Evaluate build configuration: Check your build configuration settings, including any resource optimization or shrinking options. Ensure that dotLottie files are being processed and optimized correctly during the build process.

    Consider other factors: Take into account the overall impact of the Lottie files on the APK size. If the size reduction is relatively small compared to other resources, it may not have a noticeable effect on the final APK size.

    By investigating these possibilities, you should be able to gain a better understanding of why the APK size did not decrease as expected and take appropriate steps to optimize it further if necessary.

    Login or Signup to reply.
  2. Well, APK files are already compressed (zip) and also have shrinking and obfuscation, which is what dotlottie format does to lottie JSON. Apart from that, another manifest overhead is included in the dotlottie file. So it should increase the size of the APK, and that’s exactly what happens.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search