1

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
user6288393
  • 187
  • 2
  • 11
  • I would just enable multidex. When you create the app bundle in flutter and upload it to the Play Store, Google compresses it down. My final apk size of an app I published to the Play Store is only ~9-10MB. – Scott Godfrey Sep 15 '20 at 02:14
  • And what about app performance? https://stackoverflow.com/questions/37457032/impact-of-using-multidex-on-app-performance-stability-compatibility. Or have you not found that the impact was big enough? – user6288393 Sep 15 '20 at 13:50
  • Maybe on older devices. I haven't had an older device to test it on. I do have an app published on the Play Store. Haven't seen any performance issues. – Scott Godfrey Sep 15 '20 at 21:47
  • Alright thanks. But leaving multidex aside, it is still very strange that after removing the dependencies from pubspec.yml they are still being packaged with the app. I am sure they are still being packaged because on the build I see a lint warning from one of the packages I deleted. – user6288393 Sep 17 '20 at 02:05
  • Some packages may have dependencies that the same as the ones you deleted. Such as flutter bloc depending on provider. It's still there, just not listed in your pubspec. That would be the only thing I can think of. – Scott Godfrey Sep 17 '20 at 12:43

1 Answers1

0

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.

Omatt
  • 8,564
  • 2
  • 42
  • 144