未安装动态功能模块
Dynamic Feature Module not getting installed
我正在我的应用程序中添加按需动态功能模块,但我遇到了问题。
当我安装那个功能模块时
val request = SplitInstallRequest.newBuilder()
.addModule("ondemandfeature")
.build()
splitInstallManager.startInstall(request)
打印如下日志
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)
这让我相信动态功能模块已成功安装。但是当我尝试检查已安装的模块时:
splitInstallManager.installedModules
它 returns 一个空列表。
有没有我遗漏的东西?
附加信息:
这是SplitInstallStateUpdatedListener
的日志:
// begin
PENDING (printed 4x)
DOWNLOADING (printed 14x)
INSTALLING (printed 1x)
DOWNLOADED (printed 1x)
// end
我还发现在 INSTALLING
日志之后,打印了以下内容:
I/Finsky: [2] dyv.<init>(17): com.package.my is installed but certificate mismatch
这是什么意思?
附加信息 2:
在 Pixel 3XL(Android 10)设备上,点播动态功能模块已成功下载并安装。
但是,在摩托罗拉 G5 (Android 8.1) 设备上,仅下载按需动态功能模块,但从未安装。
附加信息 3:
由于某些原因,下载和安装仅在 Android 10 台设备上有效,但我不知道为什么。
为了测试该功能,我使用了内部应用程序共享工具,我可以在其中上传应用程序包。
我发现由于我的项目配置错误,我遇到了这些问题。
请确保在您的项目中正确设置了以下内容:
- 使用
SplitCompatApplication
作为你的 Application
class;
- 在
Activities
上调用 SplitCompat.installActivity(this)
使用动态功能;
override fun attachBaseContext(newBase: Context?) {
super.attachBaseContext(newBase)
SplitCompat.installActivity(this)
}
如需了解更多信息,请仔细阅读以下代码实验室:
https://codelabs.developers.google.com/codelabs/on-demand-dynamic-delivery/
我正在我的应用程序中添加按需动态功能模块,但我遇到了问题。
当我安装那个功能模块时
val request = SplitInstallRequest.newBuilder()
.addModule("ondemandfeature")
.build()
splitInstallManager.startInstall(request)
打印如下日志
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)
这让我相信动态功能模块已成功安装。但是当我尝试检查已安装的模块时:
splitInstallManager.installedModules
它 returns 一个空列表。
有没有我遗漏的东西?
附加信息:
这是SplitInstallStateUpdatedListener
的日志:
// begin
PENDING (printed 4x)
DOWNLOADING (printed 14x)
INSTALLING (printed 1x)
DOWNLOADED (printed 1x)
// end
我还发现在 INSTALLING
日志之后,打印了以下内容:
I/Finsky: [2] dyv.<init>(17): com.package.my is installed but certificate mismatch
这是什么意思?
附加信息 2:
在 Pixel 3XL(Android 10)设备上,点播动态功能模块已成功下载并安装。
但是,在摩托罗拉 G5 (Android 8.1) 设备上,仅下载按需动态功能模块,但从未安装。
附加信息 3:
由于某些原因,下载和安装仅在 Android 10 台设备上有效,但我不知道为什么。
为了测试该功能,我使用了内部应用程序共享工具,我可以在其中上传应用程序包。
我发现由于我的项目配置错误,我遇到了这些问题。
请确保在您的项目中正确设置了以下内容:
- 使用
SplitCompatApplication
作为你的Application
class; - 在
Activities
上调用SplitCompat.installActivity(this)
使用动态功能;
override fun attachBaseContext(newBase: Context?) {
super.attachBaseContext(newBase)
SplitCompat.installActivity(this)
}
如需了解更多信息,请仔细阅读以下代码实验室: https://codelabs.developers.google.com/codelabs/on-demand-dynamic-delivery/