I updated all my built tools, supportlibrary and google Play services. But still I am getting the following error:
Error:Execution failed for task ':app:shrinkReleaseMultiDexComponents'
java.io.IOException: The output jar [app\build\intermediates\multi-dex\release\componentClasses.jar] must be specified after an input jar, or it will be empty.
I am able to fix this by setting minifyEnabled
to false
, but that is not what I want. Does anyone know how to fix it?
Multidex support library is enabled by default in API level higher than 21 (Android 5 and higher). Therefore, you do not need to add the Multidex support library.
In Android, the compilers convert your source code into DEX files. This DEX file contains the compiled code used to run the app. But there is a limitation with the DEX file. The DEX file limits the total number of methods that can be referenced within a single DEX file to 64K i.e. 65,536 methods.
It reduces the size of the application. It removes the unused classes and methods that contribute to the 64K method counts limit of an Android application. It makes the application difficult to reverse engineer by obfuscating the code.
How do I enable multidex in flutter project? The multidex support is enabled automatically. If your app supports Android SDK versions below 21, and it exceeds the 64K method limit, simply pass the –multidex flag to flutter build appbundle or flutter build apk and your app will support multidex.
Finally i able generate APK with
minifyEnabled to true
Actually the issue was some duplicate classes given some warning which i didn't noticed.
For me, i added
-dontwarn com.aphidmobile.**
in proguard-rules.pro, Same way you have to specify which libraries producing duplicate warning.
It worked Great !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With