Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android multidex not supporting with proguard

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?

like image 207
Ramesh_D Avatar asked Sep 12 '15 09:09

Ramesh_D


People also ask

Do you want to continue with adding multidex support for Android?

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.

What is multidex support?

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.

Is proguard necessary for Android?

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?

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.


1 Answers

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 !

like image 87
Ramesh_D Avatar answered Oct 03 '22 06:10

Ramesh_D