'How to remove dependencies from flutter project

I reached the 64k limit for dex files in Android. I want to avoid enabling multidex. In an attempt to reduce the amount of methods I started removing dependencies I am not using anymore. The thing is I am still getting the same error saying I have 78k methods (exactly the same number before removing the dependencies), I have already removed 3 big dependencies that should have at least lowered my methods by 1. It seems flutter is still adding the dependencies to my apk despite them being removed from pubspec.yml.

I already tried:

  • flutter clean
  • Getting & Upgrading packages
  • Restarting my IDE
  • Restarting my Computer
  • Deleting ~/.pub-cache


Solution 1:[1]

Using multi-dex way back might have a discernible impact on your app's performance. But devices nowadays are powerful enough to make it unnoticeable. I'm not saying that using multidex doesn't have an impact, but there could be no difference on real-world performance. Here's a blog post covering Android performance with multiple dex files that you could read. Enabling multidex is usually needed when you're using plugins. If you really need to avoid enabling multidex, you might just want to drop the plugin that you're using on your app.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Omatt