I seem to be running into an issue where only release builds crash with the error java.lang.NoClassDefFoundError: Failed resolution of: Lretrofit2/Retrofit$Builder; The class is irrelevant because it has not resolved other classes too in the release build. However, this does not appear on Debug builds which makes no sense at all. I have found that when I include these two dependencies:
implementation 'com.google.android.gms:play-services-ads:12.0.0'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.8.5'
the app crashes. However, when I exclude one of them, then the release builds work. Has anyone encountered this before?
The build config looks like this:
compileSdkVersion 26
buildToolsVersion 26.0.1
defaultConfig {
    applicationId "xxxx"
    minSdkVersion 21
    targetSdkVersion 27
    versionName project.rootProject.version.toString()
    multiDexEnabled true
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig xxxx
    }
}