Android Studio Add New Build Types: Unable to Resolve Dependency

Nov 13, 2019

If you add a new build type in app's build.gradle.

android {
    buildTypes {
        debug {
            ext.enableCrashlytics = false
            manifestPlaceholders = [crashlyticsEnabled: false, analyticsEnabled: false]
            signingConfig signingConfigs.config
        }
        release {
            manifestPlaceholders = [crashlyticsEnabled: true, analyticsEnabled: true]
            // shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        // NEW
        debugRelease {
            debuggable true
            ext.enableCrashlytics = false
            manifestPlaceholders = [crashlyticsEnabled: true, analyticsEnabled: true]
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
    }
}

You need to add the new buildTypes into your library modules build.gradle as well.

android {
    buildTypes {
        debugRelease {
            initWith release
            debuggable true
        }
    }
}

If your app includes a build type that a library dependency does not, you will bump into the following errors.

ERROR: Unable to resolve dependency for ':app@debugRelease/compileClasspath': Could not resolve project .

References:

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.