androidandroid-app-bundledynamic-featuredynamic-feature-moduledynamic-delivery

Dynamic Feature Module not getting installed


I am adding an on demand dynamic feature module on my app, but I am having a problem.

When I install that feature module

val request = SplitInstallRequest.newBuilder()
    .addModule("ondemandfeature")
    .build()
splitInstallManager.startInstall(request)

The following log is printed

12:54:42.301/? I/PlayCore: UID: [11113]  PID: [30056] SplitInstallService : startInstall([ondemandfeature],[])
12:54:42.807/? I/Finsky: [2] mvr.a(112): Installer: Request install. package=com.package.my, version=16081, mods=[ondemandfeature], priority=2, reason=SplitInstallService
12:54:43.239/? I/Finsky: [2] myc.a(325): IT: Required downloads: [..split.ondemandfeature.config.xxhdpi, ..split.ondemandfeature, ..split.ondemandfeature.config.pt]
12:54:43.263/? I/Finsky: [2] mpw.a(3): Downloading full file for com.package.my (..split.ondemandfeature.config.xxhdpi)
12:54:43.282/? I/Finsky: [2] mxo.a(2): IT: Send Resource Request for com.package.my downloadid: ..split.ondemandfeature.config.xxhdpi).
12:54:43.287/? I/Finsky: [2] mxc.a(8): IT: Sent download request for com.package.my, adid: ..split.ondemandfeature.config.xxhdpi, isid: 21FGah5gQD6I6P4uDfGY32
12:54:43.379/? D/DownloadManager: [6235] Starting {ondemandfeature feature for MyAppName} by {10058:com.android.vending}
12:54:44.296/? I/Finsky: [2] myc.a(174): IT: Prepare to copy com.package.my (adid: ..split.ondemandfeature.config.xxhdpi , isid: 21FGah5gQD6I6P4uDfGY32) from content://downloads/my_downloads/6235 (expect 17096 bytes, isCompressed: false)
12:54:44.322/? I/Finsky: [87461] dxz.doInBackground(18): com.package.my (..split.ondemandfeature.config.xxhdpi) (17096 bytes) copied successfully in 0 ms
12:54:44.329/? I/Finsky: [2] mxh.a(5): IT: Successfully copied APK to update com.package.my (adid: ..split.ondemandfeature.config.xxhdpi , isid: 21FGah5gQD6I6P4uDfGY32)
12:54:44.342/? I/Finsky: [2] mpw.a(3): Downloading full file for com.package.my (..split.ondemandfeature)
12:54:44.346/? I/Finsky: [2] mxo.a(2): IT: Send Resource Request for com.package.my downloadid: ..split.ondemandfeature).
12:54:44.350/? I/Finsky: [2] mxc.a(8): IT: Sent download request for com.package.my, adid: ..split.ondemandfeature, isid: 21FGah5gQD6I6P4uDfGY32
12:54:44.382/? D/DownloadManager: [6236] Starting {ondemandfeature feature for MyAppName} by {10058:com.android.vending}
12:54:44.920/? I/Finsky: [2] myc.a(174): IT: Prepare to copy com.package.my (adid: ..split.ondemandfeature , isid: 21FGah5gQD6I6P4uDfGY32) from content://downloads/my_downloads/6236 (expect 168472 bytes, isCompressed: false)
12:54:44.934/? I/Finsky: [87462] dxz.doInBackground(18): com.package.my (..split.ondemandfeature) (168472 bytes) copied successfully in 2 ms
12:54:44.938/? I/Finsky: [2] mxh.a(5): IT: Successfully copied APK to update com.package.my (adid: ..split.ondemandfeature , isid: 21FGah5gQD6I6P4uDfGY32)
12:54:44.949/? I/Finsky: [2] mpw.a(3): Downloading full file for com.package.my (..split.ondemandfeature.config.pt)
12:54:44.953/? I/Finsky: [2] mxo.a(2): IT: Send Resource Request for com.package.my downloadid: ..split.ondemandfeature.config.pt).
12:54:44.957/? I/Finsky: [2] mxc.a(8): IT: Sent download request for com.package.my, adid: ..split.ondemandfeature.config.pt, isid: 21FGah5gQD6I6P4uDfGY32
12:54:44.996/? D/DownloadManager: [6237] Starting {ondemandfeature feature for MyAppName} by {10058:com.android.vending}
12:54:45.425/? I/Finsky: [2] myc.a(174): IT: Prepare to copy com.package.my (adid: ..split.ondemandfeature.config.pt , isid: 21FGah5gQD6I6P4uDfGY32) from content://downloads/my_downloads/6237 (expect 12626 bytes, isCompressed: false)
12:54:45.439/? I/Finsky: [87461] dxz.doInBackground(18): com.package.my (..split.ondemandfeature.config.pt) (12626 bytes) copied successfully in 3 ms
12:54:45.450/? I/Finsky: [2] mxh.a(5): IT: Successfully copied APK to update com.package.my (adid: ..split.ondemandfeature.config.pt , isid: 21FGah5gQD6I6P4uDfGY32)

Which makes me believe that the dynamic feature module gets successfullt installed. But when I try to check the installed modules:

splitInstallManager.installedModules

It returns an empty list.

Is there something I am missing?


Addional info:

Here is the log of a SplitInstallStateUpdatedListener:

// begin
PENDING (printed 4x)
DOWNLOADING (printed 14x)
INSTALLING (printed 1x)
DOWNLOADED (printed 1x)
// end

I also perceived that right after the INSTALLING log, the following one is printed:

I/Finsky: [2] dyv.<init>(17): com.package.my is installed but certificate mismatch

What does it mean?


Additional info 2:

On a Pixel 3XL (Android 10) device, the on demand dynamic feature module is successfully downloaded and installed.

But, on a Motorola G5 (Android 8.1) device, the on demand dynamic feature module is only downloaded, but never installed.


Additional info 3:

For some reason, the download and installation is working only on Android 10 devices, but I don't know why.


To test that feature, I am using the internal app sharing tool, where I can upload the app bundle.


Solution

  • I've found out that I was passing through those problems due to a misconfiguration in my project.

    Please, assure that the following stuff is correctly setup in your project:

    override fun attachBaseContext(newBase: Context?) {
        super.attachBaseContext(newBase)
    
        SplitCompat.installActivity(this)
    }
    

    For more info, please do a thoughtful reading of the following codelab: https://codelabs.developers.google.com/codelabs/on-demand-dynamic-delivery/