Can not install two flavors of CHT Android app of same version.
1yuv opened this issue ยท 8 comments
Describe the bug
Can not install two different apps of CHT Android or it's flavors. For example, if I am a supervisor for two of the medic's deployments and both have Android app of same version, I can't install one of the app if another is already deployed. This happens with CHT Android app as well.
To Reproduce
Steps to reproduce the behavior:
- Download and install CHT App for CHIS
- Download and try installing Unbranded app or any Muso Mali or any other apk of same version.
- You will see an error saying app wasn't installed.
- If you'd tried Step 2 using
adb
, you'd get error like below:
adb: failed to install /Users/yuvraj/Downloads/cht-android-v1.0.0-musomali-arm64-v8a-release.apk: Failure
[INSTALL_FAILED_CONFLICTING_PROVIDER: Scanning Failed.: Can't install because provider name
org.medicmobile.webapp.mobile.fileprovider (in package org.medicmobile.webapp.mobile.musomali)
is already used by org.medicmobile.webapp.mobile.chis_ne]
Expected behavior
Second app should be installed without error.
Logs
Adb Log:
adb: failed to install /Users/yuvraj/Downloads/cht-android-v1.0.0-musomali-arm64-v8a-release.apk: Failure
[INSTALL_FAILED_CONFLICTING_PROVIDER: Scanning Failed.: Can't install because provider name
org.medicmobile.webapp.mobile.fileprovider (in package org.medicmobile.webapp.mobile.musomali)
is already used by org.medicmobile.webapp.mobile.chis_ne]
Environment
- Android Version: (eg: 11)
- App Version: (eg: 1.0)
Additional context
Different version of CHT Android app (for example: CHIS v1.0 and Muso mali v0.9) can be installed side by side.
Some notes:
- We set the file provider in the manifest
- Maybe we can change the
android:authorities
to be unique per flavor, sample:android:authorities="${applicationId}.fileprovider"
Not sure how to access the flavor name from here, needs research.
This is high priority to allow for side installs of testing apps, and also some projects rely on multiple flavors for multiple logins for users with many docs.
It looks like it's possible to inject the app id into the manifest: https://developer.android.com/studio/build/manage-manifests#inject_build_variables_into_the_manifest
Let's give this a try?
For AT, please consider the following:
- Should be able to install more than 1 flavor in 1 device.
- The fix was around the file picket feature, please verify that the file picker feature is working as before. See details here about how that should work.
Ready for AT in this PR
I'll also take a time to test this as well.
User: CHW
Config: Default
Environment: Local with docker helper script
cht-core version: master
Platform: Mobile App. APK generated with branch 287-install-many-flavors-at-the-same-time
Four apps from different "flavors" installed in the same phone without issues
File picker feature is working as expected.
Android 5.1
Phone: Alcatel OneTouch 50560
Android System WebView Version: 95.0.4638.74
scrcpy.-.SM-A015A.-.15.June.2022.mp4
Android 10
Phone: Samsung Galaxy A01
Android System WebView Version: 101.0.4951.61
Notification.Centre.-.Notification.Center.-.15.June.2022.mp4
Samsung Galaxy Tab A7 Lite
OS: Android 11
Environment: Muso Mali Production
User: adtest (CHW)
Installed: 4 flavors of fixed version.
Log:
> ./adb install ~/Downloads/apk/unbranded/debug/cht-android-SNAPSHOT-unbranded-arm64-v8a-debug.apk
Performing Streamed Install
Success
> ./adb install ~/Downloads/apk/musomali/debug/cht-android-SNAPSHOT-musomali-arm64-v8a-debug.apk
Performing Streamed Install
Success
> ./adb install ~/Downloads/apk/moh_mali/debug/cht-android-SNAPSHOT-moh_mali-arm64-v8a-debug.apk
Performing Streamed Install
Success
> ./adb install ~/Downloads/apk/livinggoods/debug/cht-android-SNAPSHOT-livinggoods-arm64-v8a-debug.apk
Performing Streamed Install
Success
Verified by installing multiple flavors and logging in as users.