How to set Target Sdk on Feature Module (Gradle 7.0.2)

Viewed 103

I want to change what was previously a library (com.android.library) to a feature module (com.android.dynamic-feature). However, when I do so, I am unable to set the targetSdk or targetSdkVersion:

plugins {
    id("com.android.dynamic-feature")
    kotlin("kapt")
    kotlin("android")
}

android { // this = DynamicFeatureExtension
    compileSdk = BuildConfig.SdkVersion.COMPILE

    defaultConfig {
        minSdk = BuildConfig.SdkVersion.MIN
        targetSdk = BuildConfig.SdkVersion.TARGET // targetSdk is not found
        targetSdkVersion(BuildConfig.SdkVersion.TARGET) // targetSdkVersion is not found
    ...
}

The gradle version is 7.0.2: distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

I notice that when I compare it with the Plaid App, which doesn't suffer the same problems, that their gradle version is 5.6.4.

0 Answers
Related