3

I am getting the following error after migrating from instant-app to app-bundles.

Could not set unknown property 'dynamicFeatures' for object of type com.android.build.gradle.AppExtension.

I have followed the instructions at https://developer.android.com/topic/google-play-instant/feature-module-migration.

I have tried updating build tools and target SDK versions of the app, but it did not help.

This is build.gradle file for my dynamic-feature module.

apply plugin: 'com.android.dynamic-feature'

android {
    dynamicFeatures = [":features:base"]  // This is where error points to!
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation project(':features:base')

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Versions used in the app:

    buildTools = "28.0.3"
    compileSdk = 28
    targetSdk = 28
    minSdkInstant = 21
    minSdk = 21
    archLifecycleVersion = "1.1.1" //"2.0.0"
    ktxVersion = "1.0.1"

    supportLibVersion = "28.0.0"
    playServicesAuthVersion = "11.8.0"
    espressoVersion = "3.0.1"
    androidTestVersion = "0.5"
    hamcrestVersion = "1.3"
    junitVersion = "4.12"

gradle-wrapper version: 5.1.1

Ashwin M K
  • 91
  • 6

1 Answers1

3

I was setting dynamicFeatures variable in a dynamic-feature module, which is incorrect. You must set dynamicFeatures variable only in your base module.

feature1/build.gradle

apply plugin: 'com.android.dynamic-feature'

android {
    ...
    // do not set dynamicFeatures here!
}

app/build.gradle

apply plugin: 'com.android.application'

android {
    ...
    dynamicFeatures = [":feature1", ":feature2"]
}

You can see a sample project here: https://github.com/CapTechMobile/Android-App-Bundle-Sample

Ashwin M K
  • 91
  • 6