microsoft / appcenter-sdk-android

Development repository for the App Center SDK for Android
Other
281 stars 134 forks source link

Failed to download app update #1550

Closed kamal-mobile-dev closed 2 years ago

kamal-mobile-dev commented 3 years ago

Description

Hello, I am getting latest update in app, but when it dowloaded and it comes message "Failed to download app update". its happening in some devices like Realme X7 max pro

Logs 2021-09-01 14:03:28.486 31995-32039/? D/AppCenterDistribute: Download was successful for id=307 2021-09-01 14:03:28.488 31995-32039/? D/AppCenterDistribute: Cannot resolve install intent for content://downloads/all_downloads/307 2021-09-01 14:03:28.488 31995-32039/? E/AppCenterDistribute: Failed to download 1.0.50 (50) update: Installer not found

Repro Steps

Please list the steps used to reproduce your issue.

  1. create fresh build from app center
  2. then create another new build, you will get new update but it will not download.

Details

  1. Which SDK version are you using? -4.2.0
  2. Which OS version did you experience the issue on?
    • Android 11
  3. What device version did you see this error on? Were you using an emulator or a physical device?
    • Realme X7 max pro
  4. Please enable verbose logging for your app using AppCenter.setLogLevel(Log.VERBOSE) before your call to AppCenter.start(...) and include the logs here:
DmitriyKirakosyan commented 3 years ago

Hi @kamalthebidigital

Thank you for bringing this issue to our attention!

Could you please share more details on how you distribute your builds to the App Center portal? We had a couple of similar issues (#1499, #1418), could you please check if your problem is also related to the tools you use for the apk distribution.

Also, can you provide verbose logs of your app with AppCenter.setLogLevel(Log.VERBOSE); set right before calling AppCenter.Start.

AnastasiaKubova commented 3 years ago

Also could you please clarify what is your compile and target SDK versions? And how do you build your apk - on the App Center Portal or manually? Does it happen from time to time or regularly?

kamal-mobile-dev commented 3 years ago

Hello @AnastasiaKubova , Here is compile and target SDK versions details

    buildToolsVersion = "30.0.2"
    minSdkVersion = 21
    compileSdkVersion = 30
    targetSdkVersion = 30
    googlePlayServicesAuthVersion = "16.0.1"

    appCenterSdkVersion = '4.2.0'
AnastasiaKubova commented 3 years ago

Thanks, @kamalthebidigital ! Could you tell me please how do you build your apk - on the App Center Portal or manually? Does it happen from time to time or regularly?

kamal-mobile-dev commented 3 years ago

Hello @AnastasiaKubova , I created apk through App Center Portal and most of our users is facing this issue.

AnastasiaKubova commented 3 years ago

Thanks for the details, I will check this behavior and return with the results.

AnastasiaKubova commented 3 years ago

I checked this issue via build on the App Center portal and for me all work well. Is this error occurring now or was it just once?

kamal-mobile-dev commented 3 years ago

Hello @AnastasiaKubova , still facing same issue, this issue is not coming in all android devices. for eg. Realme x7 max , facing this issue.

AnastasiaKubova commented 3 years ago

Thanks for the details. It doesn't look like an SDK issue. Could you please open a support ticket on the App Center portal (click the help menu (?) in the upper right corner of the App Center porta).

build3r commented 3 years ago

@AnastasiaKubova Having the same issue on Realme devices with Android 11 The Upldate dialog in show and when we click download after a few second we get Failed to download app update This is at line RealeaseDownloadListener : 141

As this happens only on the users device its very hard to debug and given work from home scenario we can't even get hands on the device having issues. We have around 20% of our user base having this problem. But I was able to redirect Appcenter logs to a custom logger, but the logs end after the update dialog

2   info    24-09-21 15:55:38  h     App Center SDK configured successfully.
2   debug   24-09-21 15:55:38  a     Cannot read instrumentation variables in a non-test environment.
22851   debug   24-09-21 15:55:38  a     Loaded stored sessions: {}
22854   debug   24-09-21 15:55:38  a     Network 356 is available.
22854   debug   24-09-21 15:55:38  a     Network has been connected.
22851   warn    24-09-21 15:55:38  q     Unable to get installID from Shared Preferences
22851   info    24-09-21 15:55:38  e     Changed maximum database size to 10485760 bytes.
22851   debug   24-09-21 15:55:38  a     addGroup(group_core)
22851   debug   24-09-21 15:55:38  a     checkPendingLogs(group_core) pendingLogCount=0 batchTimeInterval=3000
22851   debug   24-09-21 15:55:38  a     App Center initialized.
22851   debug   24-09-21 15:55:38  a     removeGroup(group_distribute)
22851   debug   24-09-21 15:55:38  a     removeGroup(group_distribute/one)
22851   debug   24-09-21 15:55:38  a     addGroup(group_distribute)
22851   debug   24-09-21 15:55:38  a     checkPendingLogs(group_distribute) pendingLogCount=0 batchTimeInterval=3000
22851   debug   24-09-21 15:55:38  a     addGroup(group_distribute/one)
22851   debug   24-09-21 15:55:38  a     checkPendingLogs(group_distribute/one) pendingLogCount=0 batchTimeInterval=3000
22851   debug   24-09-21 15:55:38  a     Distribute workflow will be resumed on activity resume event.
22851   info    24-09-21 15:55:38  g     Distribute service started from application.
22851   debug   24-09-21 15:55:38  a     Storing a log to the Persistence database for log type startService with flags=1
22851   debug   24-09-21 15:55:38  a     Stored a log to the Persistence database for log type startService with databaseId=1
22851   debug   24-09-21 15:55:38  a     enqueue(group_core) pendingLogCount=1
22851   debug   24-09-21 15:55:38  a     checkPendingLogs(group_core) pendingLogCount=1 batchTimeInterval=3000
2   debug   24-09-21 15:55:38  a     Resetting workflow on entering foreground.
2   debug   24-09-21 15:55:38  a     Resume distribute workflow...
2   debug   24-09-21 15:55:38  a     Get latest release details...
2   debug   24-09-21 15:55:38  a     Check if we need to report release installation..
2   debug   24-09-21 15:55:38  a     Current release was already reported, skip reporting.
22866   verbose 24-09-21 15:55:38  a     Calling https://api.appcenter.ms/v0.1/public/sdk/apps/****************************daaaab07/releases/latest?release_hash=598c9774ed895822b2978d1fdf238028e76d550469385278721ad5114853165e...
22866   verbose 24-09-21 15:55:38  a     Headers: {}
22866   verbose 24-09-21 15:55:39  a     HTTP response status=200 payload={"app_name":"K***L-Staging","app_display_name":"K***L Staging","app_os":"Android","app_icon_url":"https://appcenter-filemanagement-distrib4ede6f06e.azureedge.net/00ddbb33-bf1f-40c9-bccc-1a55394aa499/u3.png?sv=2019-02-02&sr=c&sig=87FCC4ellATZ85NHb%2FT4bVCI7WkgnGmY2apxPRkcp9w%3D&se=2021-09-27T12%3A05%3A36Z&sp=r","release_notes_url":"https://install.appcenter.ms/orgs/K***L/apps/K***L-Staging/distribution_groups/Open","owner":{"name":"K***L","display_name":"K***L"},"is_external_build":false,"origin":"appcenter","id":24,"version":"176","short_version":"3.0.5-staging_release","size":7016746,"min_os":"6.0","android_min_api_level":"23","device_family":null,"bundle_identifier":"in.onionlife.K***L.staging","fingerprint":"f2658836fbbd13b5c017f1d16adf61dc","uploaded_at":"2021-09-13T12:02:01.473Z","download_url":"https://appcenter-filemanagement-distrib3ede6f06e.azureedge.net/e9ae578c-0d8e-48c4-a813-928b39f16f0a/K***L-3.0.5-176-stagingRelease.apk?sv=2019-02-02&sr=c&sig=F7Do7prhFGsYGTtQzfHWJRl0rQpK61siZG39JP3UzZM%3D&se=2021-09-25T07%3A43%3A16Z&sp=r","install_url":"https://appcenter-filemanagement-distrib3ede6f06e.azureedge.net/e9ae578c-0d8e-48c4-a813-928b39f16f0a/K***L-3.0.5-176-stagingRelease.apk?sv=2019-02-02&sr=c&sig=F7Do7prhFGsYGTtQzfHWJRl0rQpK61siZG39JP3UzZM%3D&se=2021-09-25T07%3A43%3A16Z&sp=r","mandatory_update":false,"enabled":true,"is_latest":true,"release_notes":"","can_resign":null,"package_hashes":["180f1d398a73aba51847f8519cda062516314251b14a760387becbe183b286e4"],"destination_type":"group","status":"available","distribution_group_id":"d49a03a0-1a74-468a-9378-d31ba63acbac","distribution_groups":[{"id":"d49a03a0-1a74-468a-9378-d31ba63acbac","name":"Open","origin":"appcenter","display_name":"Open","is_public":true}]}
2   debug   24-09-21 15:55:39  a     No sessions were logged before, ignore sending of the distribution start session log.
2   info    24-09-21 15:55:45  h     App Center SDK configured successfully.
2   debug   24-09-21 15:55:45  a     Cannot read instrumentation variables in a non-test environment.
22857   debug   24-09-21 15:55:45  a     Loaded stored sessions: {1632479138054=1632479138054//1632479138047}
22857   info    24-09-21 15:55:45  e     Changed maximum database size to 10485760 bytes.
22857   debug   24-09-21 15:55:45  a     addGroup(group_core)
22863   debug   24-09-21 15:55:45  a     Network 356 is available.
22863   debug   24-09-21 15:55:45  a     Network has been connected.
22857   debug   24-09-21 15:55:45  a     checkPendingLogs(group_core) pendingLogCount=0 batchTimeInterval=3000
22857   debug   24-09-21 15:55:45  a     App Center initialized.
22857   debug   24-09-21 15:55:45  a     removeGroup(group_distribute)
22857   debug   24-09-21 15:55:45  a     removeGroup(group_distribute/one)
22857   debug   24-09-21 15:55:45  a     addGroup(group_distribute)
22857   debug   24-09-21 15:55:45  a     checkPendingLogs(group_distribute) pendingLogCount=0 batchTimeInterval=3000
22857   debug   24-09-21 15:55:45  a     addGroup(group_distribute/one)
22857   debug   24-09-21 15:55:45  a     checkPendingLogs(group_distribute/one) pendingLogCount=0 batchTimeInterval=3000
22857   debug   24-09-21 15:55:45  a     Distribute workflow will be resumed on activity resume event.
22857   info    24-09-21 15:55:45  g     Distribute service started from application.
22857   debug   24-09-21 15:55:45  a     Storing a log to the Persistence database for log type startService with flags=1
22857   debug   24-09-21 15:55:45  a     Stored a log to the Persistence database for log type startService with databaseId=2
22857   debug   24-09-21 15:55:45  a     enqueue(group_core) pendingLogCount=1
22857   debug   24-09-21 15:55:45  a     checkPendingLogs(group_core) pendingLogCount=1 batchTimeInterval=3000
2   debug   24-09-21 15:55:45  a     Resetting workflow on entering foreground.
2   debug   24-09-21 15:55:45  a     Resume distribute workflow...
2   debug   24-09-21 15:55:45  a     Get latest release details...
2   debug   24-09-21 15:55:45  a     Check if we need to report release installation..
2   debug   24-09-21 15:55:45  a     Current release was already reported, skip reporting.
22866   verbose 24-09-21 15:55:45  a     Calling https://api.appcenter.ms/v0.1/public/sdk/apps/****************************daaaab07/releases/latest?release_hash=598c9774ed895822b2978d1fdf238028e76d550469385278721ad5114853165e...
22866   verbose 24-09-21 15:55:45  a     Headers: {}
2   info    24-09-21 15:56:04  h     App Center SDK configured successfully.
2   debug   24-09-21 15:56:04  a     Cannot read instrumentation variables in a non-test environment.
22859   debug   24-09-21 15:56:04  a     Loaded stored sessions: {1632479138054=1632479138054//1632479138047, 1632479145680=1632479145680//1632479145678}
22863   debug   24-09-21 15:56:04  a     Network 356 is available.
22859   info    24-09-21 15:56:04  e     Changed maximum database size to 10485760 bytes.
22859   debug   24-09-21 15:56:04  a     addGroup(group_core)
22863   debug   24-09-21 15:56:04  a     Network has been connected.
22859   debug   24-09-21 15:56:04  a     checkPendingLogs(group_core) pendingLogCount=0 batchTimeInterval=3000
22859   debug   24-09-21 15:56:04  a     App Center initialized.
22859   debug   24-09-21 15:56:04  a     removeGroup(group_distribute)
22859   debug   24-09-21 15:56:04  a     removeGroup(group_distribute/one)
22859   debug   24-09-21 15:56:04  a     addGroup(group_distribute)
22859   debug   24-09-21 15:56:04  a     checkPendingLogs(group_distribute) pendingLogCount=0 batchTimeInterval=3000
22859   debug   24-09-21 15:56:04  a     addGroup(group_distribute/one)
22859   debug   24-09-21 15:56:04  a     checkPendingLogs(group_distribute/one) pendingLogCount=0 batchTimeInterval=3000
22859   debug   24-09-21 15:56:04  a     Distribute workflow will be resumed on activity resume event.
22859   info    24-09-21 15:56:04  g     Distribute service started from application.
22859   debug   24-09-21 15:56:04  a     Storing a log to the Persistence database for log type startService with flags=1
22859   debug   24-09-21 15:56:04  a     Stored a log to the Persistence database for log type startService with databaseId=3
22859   debug   24-09-21 15:56:04  a     enqueue(group_core) pendingLogCount=1
22859   debug   24-09-21 15:56:04  a     checkPendingLogs(group_core) pendingLogCount=1 batchTimeInterval=3000
2   debug   24-09-21 15:56:04  a     Resetting workflow on entering foreground.
2   debug   24-09-21 15:56:04  a     Resume distribute workflow...
2   debug   24-09-21 15:56:04  a     Get latest release details...
2   debug   24-09-21 15:56:04  a     Check if we need to report release installation..
2   debug   24-09-21 15:56:04  a     Current release was already reported, skip reporting.
22874   verbose 24-09-21 15:56:04  a     Calling https://api.appcenter.ms/v0.1/public/sdk/apps/****************************daaaab07/releases/latest?release_hash=598c9774ed895822b2978d1fdf238028e76d550469385278721ad5114853165e...
22874   verbose 24-09-21 15:56:04  a     Headers: {}
22874   verbose 24-09-21 15:56:05  a     HTTP response status=200 payload={"app_name":"K***L-Staging","app_display_name":"K***L Staging","app_os":"Android","app_icon_url":"https://appcenter-filemanagement-distrib4ede6f06e.azureedge.net/00ddbb33-bf1f-40c9-bccc-1a55394aa499/u3.png?sv=2019-02-02&sr=c&sig=87FCC4ellATZ85NHb%2FT4bVCI7WkgnGmY2apxPRkcp9w%3D&se=2021-09-27T12%3A05%3A36Z&sp=r","release_notes_url":"https://install.appcenter.ms/orgs/K***L/apps/K***L-Staging/distribution_groups/Open","owner":{"name":"K***L","display_name":"K***L"},"is_external_build":false,"origin":"appcenter","id":24,"version":"176","short_version":"3.0.5-staging_release","size":7016746,"min_os":"6.0","android_min_api_level":"23","device_family":null,"bundle_identifier":"in.onionlife.K***L.staging","fingerprint":"f2658836fbbd13b5c017f1d16adf61dc","uploaded_at":"2021-09-13T12:02:01.473Z","download_url":"https://appcenter-filemanagement-distrib3ede6f06e.azureedge.net/e9ae578c-0d8e-48c4-a813-928b39f16f0a/K***L-3.0.5-176-stagingRelease.apk?sv=2019-02-02&sr=c&sig=RylyqB1nyhbEFXc9wp2IueQWlsZMCSJWbpWURk6kbXo%3D&se=2021-09-25T10%3A26%3A05Z&sp=r","install_url":"https://appcenter-filemanagement-distrib3ede6f06e.azureedge.net/e9ae578c-0d8e-48c4-a813-928b39f16f0a/K***L-3.0.5-176-stagingRelease.apk?sv=2019-02-02&sr=c&sig=RylyqB1nyhbEFXc9wp2IueQWlsZMCSJWbpWURk6kbXo%3D&se=2021-09-25T10%3A26%3A05Z&sp=r","mandatory_update":false,"enabled":true,"is_latest":true,"release_notes":"","can_resign":null,"package_hashes":["180f1d398a73aba51847f8519cda062516314251b14a760387becbe183b286e4"],"destination_type":"group","status":"available","distribution_group_id":"d49a03a0-1a74-468a-9378-d31ba63acbac","distribution_groups":[{"id":"d49a03a0-1a74-468a-9378-d31ba63acbac","name":"Open","origin":"appcenter","display_name":"Open","is_public":true}]}
2   debug   24-09-21 15:56:05  a     Check if latest release is more recent.
2   debug   24-09-21 15:56:05  a     Latest release more recent=true
2   debug   24-09-21 15:56:05  a     Removing download and notification id=6121
2   debug   24-09-21 15:56:05  a     Latest release is more recent.
2   debug   24-09-21 15:56:05  a     Calling listener.onReleaseAvailable.
2   debug   24-09-21 15:56:05  a     Show default update dialog.
AnastasiaKubova commented 3 years ago

Hi, @build3r! Thanks for getting in touch with us! Based on the request above the same issue happens also when building .apk via the App Center portal so I can suspend that it is not an SDK issue. Please open a support ticket on the App Center portal (click the help menu (?) in the upper right corner of the App Center porta).

build3r commented 3 years ago

@AnastasiaKubova This does not happen on App Center portal, I can download apk there without any problem. Also 80% of users can download apk with problems. Only specific devices are having this issue. Looks like its either Download Manager issue or Package Installer issue. Both of which are related to SDK.

AnastasiaKubova commented 3 years ago

@build3r we had a couple of similar issues (#1499, #1418) and both were not related to App Center SDK. Please open a support ticket on the App Center portal (click the help menu (?) in the upper right corner of the App Center porta).

build3r commented 3 years ago

Adding the details The above mentioned workarounds did not work. Stumbled upon this thread android-10-no-activity-found-to-handle-intent Which similar to the current problem and states that

ACTION_VIEW (for APKs) and ACTION_INSTALL_PACKAGE were deprecated in Android 10. You need to switch to the PackageInstaller API.

And mentioned to use the new packageInstaller sessions api InstallApkSessionApi

Mr777Nick commented 3 years ago

Can confirm that this issue also happening on Realme 5 Pro devices,

AnastasiaKubova commented 3 years ago

Hi, @Mr777Nick ! Does this issue happen only on Realme devices with Android 11? Or on the different Android versions? For now as an alternative way for Realm devices you can try to update your apps via the App Center install portal.

build3r commented 3 years ago

Hi @AnastasiaKubova I procured a Realme Device to understand this issue and come up with a fix. The problem was with the DownloadManager on Realme device. The manager would download the apk but the files would in-accesible. I have come up with solution of passing an app external file Uri to the Download manager and then triggering the install by exposing this Uri via file provider. Here are minimal changes which I needed to do for it to work. I'll add more details via mail. https://github.com/build3r/appcenter-sdk-android/commit/1bc4c53abc3528668df744362c70c6f8c31dc661 Tested on Realme 8 (RMX3085)

AnastasiaKubova commented 3 years ago

Hi, @build3r ! Thanks for your detailed investigation and your solution. I will review it and notify you about the results in the support ticket.

jeroen-corteville commented 2 years ago

Hi @AnastasiaKubova, Just to add on this, I'm seeing the same problem with my OnePlus 9, updated to Android 12. My colleague with an Android 11 OnePlus 6T was able to get the app to update without problems.

AnastasiaKubova commented 2 years ago

Hi, @jeroen-corteville! Thanks for the details. We already prepared a fix for it and it will be released soon. I will notify you when the fix will be available.

jlsjonas commented 2 years ago

@AnastasiaKubova how long does it take to release a fix for a broken SDK for any new android phone following the updated spec? This has been pending for half a year now...

DmitriyKirakosyan commented 2 years ago

Hi @jlsjonas , the fix was released on Dec 21. It is now available in version 4.4.2.

arunprasath218 commented 1 year ago

Hi I am facing this same issue but the error message is slightly different - Failed to install app update.

It's happening on Android 11 as well. SDK Version 5.0.0

Do advice

MikhailSuendukov commented 1 year ago

@arunprasath218 I was unable to reproduce your problem, for further investigation it is necessary that you enable verbose logging by AppCenter.setLogLevel(android.util.Log.VERBOSE); and send them to us. It would also be helpful if you could provide a small demo project that reproduces your bug.