Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFlutter Gradle should automatically add MultiDex #21009
Comments
This comment has been minimized.
This comment has been minimized.
slightfoot
closed this
Aug 24, 2018
slightfoot
reopened this
Aug 24, 2018
This comment has been minimized.
This comment has been minimized.
BugsBunnyBR
commented
Aug 25, 2018
While multidex is important, it should not be the default option. It makes the app loading and compiling time longer. |
zoechi
added
tool
t: gradle
labels
Aug 25, 2018
zoechi
added this to the Goals milestone
Aug 25, 2018
This comment has been minimized.
This comment has been minimized.
@BugsBunnyBR I believe the compilation time is not as big of a deal, as it once was. Remember instant-run, and other tooling use multiple dex files and use I think as long as it is handled by the Flutter framework and not left to the developer to figure out the black magic then I'm all happy for either, fixed or a opt-in feature, like a extra parameter on the create command, and/or a tick-box in the IntelliJ plugin. Either way, along as something is done, I'm happy. |
zoechi
referenced this issue
Sep 23, 2018
Closed
after installing this plugin my app wont build on android #22173
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Maybe we should trigger this automatically when we hit the limit? (You're likely to hit the limit with some of our plugins.) |
gspencergoog
added this to To do
in Flutter Tool Tasks
via automation
Sep 25, 2018
This comment has been minimized.
This comment has been minimized.
Seems reasonable to support. I agree with the earlier comment that it should not be enabled by default. We might consider exposing this via pubspec for ephemeral projects. Once the host app is made editable, it's up to the developer to deal with this, I think. |
matthew-carroll
added
the
a: existing-apps
label
Sep 26, 2018
gspencergoog
self-assigned this
Sep 26, 2018
This comment has been minimized.
This comment has been minimized.
I just upgraded to Android Studio 3.2.0 and saw this in the notes:
This might have an effect on this ticket. |
This comment has been minimized.
This comment has been minimized.
That's great, and it helps, but I don't think it has too much effect here, because Flutter supports API Level 16 and above, so we still have to do something about API levels 16-20. |
This comment has been minimized.
This comment has been minimized.
Correct. Just setting minSdkVersion = 21 in |
This comment has been minimized.
This comment has been minimized.
My earlier remark was not to set the minSdk, but rather to be aware of the build change, just in case the app developer changes the minSdk to 21 or above and screws up the possible fix for this ticket. |
This comment has been minimized.
This comment has been minimized.
Either way you always going to need the |
This comment has been minimized.
This comment has been minimized.
raveesh-me
commented
Oct 1, 2018
This would be amazing... |
zoechi
referenced this issue
Oct 3, 2018
Closed
Flutter Plugins for Firebase, Execution failed for task app:transformDexArchiveWithExternalLibsDexMergerForDebug #22556
Oct 18, 2018
This was referenced
zoechi
referenced this issue
Nov 6, 2018
Open
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. #23929
This comment has been minimized.
This comment has been minimized.
drexel-ue
commented
Nov 10, 2018
I've just run into the same issue trying to build
attempting the fix now |
This comment has been minimized.
This comment has been minimized.
robert-stevens
commented
Nov 13, 2018
@drexel-ue i've just run into it now, do you have any fix? |
This comment has been minimized.
This comment has been minimized.
Enable Multidex as described here, and adjust it with my instructions in the description of the ticket. If that doesn't work, today is Wednesday which is Flutter #HumpDayQandA and you can join us on Zoom to chat about the issue and resolve it. https://tinyurl.com/HumpDayQandA |
This comment has been minimized.
This comment has been minimized.
Leisser
commented
Jan 1, 2019
•
Am new to flutter and also to app-dev but not sure how i must treat this code
in my flutter application, am i supposed to put it in my main.dart. Am too confused. I've edited my app/build.gradle script and enabled multiDexEnabled, added implementation 'com.android.support:multidex:1.0.3' and multiDexKeepFile file('multidex-flutter.txt'). |
zoechi
referenced this issue
Feb 8, 2019
Open
error - Cannot fit requested classes in a single dex file #27682
dnfield
referenced this issue
Feb 8, 2019
Open
Including multiple plugins in an empty app exceeds the Android dex limit #27702
This comment has been minimized.
This comment has been minimized.
wtoalabi
commented
Feb 9, 2019
I am seriously looking for a solution to this. |
This comment has been minimized.
This comment has been minimized.
For those that are having problems.. follow these instructions.
Those instructions show you how to create a android Application class and attach MultiDex support library to it. More info can be found here: https://developer.android.com/studio/build/multidex Don't forget you'll need to add
Side Note: If you upgrade your Android project to use AndroidX then you'll need to change the dependency from |
This comment has been minimized.
This comment has been minimized.
wtoalabi
commented
Feb 9, 2019
Very detailed. Following your instructions, here are my observations and where i'm stuck:
I dont feel comfortable going further with the rest of the instructions until I am able to sort these 2 out. |
This comment has been minimized.
This comment has been minimized.
You need to have |
This comment has been minimized.
This comment has been minimized.
wtoalabi
commented
Feb 9, 2019
Apologies if I am sounding so dumb....I cant see where to sync gradle. |
This comment has been minimized.
This comment has been minimized.
wtoalabi
commented
Feb 10, 2019
So, I realise I cant beat the 64k limit, at least not with my constraints (below 20SDKs are a must). I eventually settled with adding Proguard to the debug section of my buildTypes (within the project level build.gradle file). |
mklim
referenced this issue
Feb 13, 2019
Open
Issue with cloud_firestore - Cannot fit requested classes in a single dex file. #20747
This comment has been minimized.
This comment has been minimized.
Leisser
commented
Feb 15, 2019
@slightfoot thanks for the help am humbled. |
slightfoot commentedAug 24, 2018
•
edited
Steps to Reproduce
Build app with more than 64K methods.
Logs
Recommended Changes
Project template or
flutter.gradle
script should set themultiDexEnabled
property to true, and add themultiDexKeepFile file('multidex-flutter.txt')
config file. Example: multidex-flutter.txtProject template or
flutter.gradle
script should add the multidex dependency.implementation 'com.android.support:multidex:1.0.3'
FlutterApplication should have the following addition.
Adding the
multiDexKeepFile
is important as theFlutterApplication
class and its dependencies are required to me in the primary dex file or the Application class may its onCreate lifecycle event.