I get the error com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzau;
when i run my app
The gradle files are
ap
I was also having this issue, I tried many ways to solve this issue. What worked for me was removing following line from my gradle.
compile 'com.google.firebase:firebase-core:16.0.3'
At first I have both firebase-core
and firebase-ml-vision
(what I need was only firebase-ml-vision
) like following.
compile 'com.google.firebase:firebase-ml-vision:17.0.0'
compile 'com.google.firebase:firebase-core:16.0.3'
After I remove the line I got following warning,
Warning: The app gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended.
But, according to official docs the core dependency can be absent (https://firebase.google.com/docs/ml-kit/android/detect-faces), so it can be ignored.
For anyone wondering how to fix this for Apache Cordova plugins, I fixed this problem by ensuring all plugin.xml
files include the same major and minor version, but latest revision, like this:
<framework src="com.google.firebase:firebase-auth:15.0.+" />
<framework src="com.google.firebase:firebase-messaging:15.0.+" />
When using 15.0.0
above, the com.android.dex.DexException
error was raised for some reason. By using +
for the revision number (which means, latest), everything worked perfectly with cordova 7.1.0 and cordova-android 6.3.0.
Remember to remove and re-add the android platform after editing plugin.xml
from plugins, otherwise your changes won't be applied at all!
Also: Ensure only ONE gradle file is applying this, just in case:
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:3.0.0'
}