[Solved] Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode
This error usually is caused when a same library is referenced more than once in gradle build configurati
The solution is very simple we’ve to remove the plugin that is causing the conflict. Issue the below provided two commands one after other.
Change the current directory to the ionic project and then issue the below commands.
$ cordova plugin remove com.google.playservices // version 19 $ cordova plugin add com.google.playservices // version 21
Those command basically remove the conflicting plugin and then re-install it again. Somehow this fixes the issue but don’t know how this internally works perhaps configuration is re-written when plugin is added again.
Below references were used to solve this issue and you too might find them useful in case above command did not work for you.
REFERENCES:
- http://stackoverflow.com/questions/22468700/unexpected-top-level-exception-com-android-dex-dexexception-multiple-dex-files
- http://stackoverflow.com/questions/22958979/multiple-dex-files-define-lcom-google-ads-adrequesterrorcode-and-multiple-dex-f
- https://github.com/floatinghotpot/cordova-plugin-admob/issues/196