这个错误通常是由于Dex方法数超过限制引起的,可以尝试以下解决方法:
android {
defaultConfig {
// ...
multiDexEnabled true
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
public class MyApplication extends MultiDexApplication {
// ...
}
或者
public class MyApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
// ...
}
android {
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
将上述解决方法按照实际情况进行尝试,一般能够解决FCM导致构建失败的问题。