如何在功能模块上设置目标Sdk(Gradle 7.0.2)

sg3maiej  于 2023-01-13  发布在  其他
关注(0)|答案(1)|浏览(127)

我想将以前的librarycom.android.library)更改为feature modulecom.android.dynamic-feature),但是,当我这样做时,我无法设置targetSdktargetSdkVersion

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
    ...
}

Gradle版本为7.0.2:distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
我注意到,当我将它与Plaid App(没有遇到同样的问题)进行比较时,他们的gradle版本是5.6.4。

rryofs0p

rryofs0p1#

你能试试这个吗?

defaultConfig.apply {
        minSdk = BuildConfig.SdkVersion.MIN
        targetSdk = BuildConfig.SdkVersion.TARGET
        targetSdkVersion(BuildConfig.SdkVersion.TARGET)
}

相关问题