appcenter-sdk-dotnet icon indicating copy to clipboard operation
appcenter-sdk-dotnet copied to clipboard

Appcenter in-app updates do not work on phone with MIUI optimizations enabled

Open damiand2 opened this issue 3 years ago • 10 comments

On phones with MIUI (i.e. Xiaomi Redmi) with MIUI optimizations enabled (Settings/Additional Settings/Developer Options/Turn on MIUI optimizations) in-app update stopped working (around NOV 2021 but i had no time earlier to take a look). With MIUI optimizations enabled first time there is an update, applicaiton displays standard popup, asks for needed permissions (install from unknows source, display popups over other apps, etc.) and after installing i can see small popup at the bottom of the app: Something went wrong. Update was not installed serveral times. With MIUI optimizations disabled, first such in-app update works (application is closed and started again). However subsequent releases are completly ignored by such app (it never detects newer releases again, at least not during the same day)

Details

  1. What is your app platform (Xamarin.Android or Xamarin.iOS or UWP)?
    • Xamarin.Forms (ios, Android)
  2. If using Xamarin.Forms or if using portable/shared code to call our SDK APIs, are you using shared project, PCL code or .NET standard code for the application? Which .NET standard version or which PCL profile?
    • .net standard 2.0
  3. Which SDK version are you using?
    • 4.5.0
  4. Which OS version did you experience the issue on?
    • Android 10 QP1A.190711.020, MIUI 12.0.6
  5. What device version did you see this error on? Were you using an emulator or a physical device?
    • Xiaomi Redmi Note 8 Pro (however others with different phones also confirmed that in-app update does not work at all or, without MIUI, works only single time a day)
  6. What third party libraries are you using?
    • ItemGroup> PackageReference Include="Com.Airbnb.Xamarin.Forms.Lottie" Version="4.1.0" /> PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.5.0" /> PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.5.0" /> PackageReference Include="Microsoft.AppCenter.Distribute" Version="4.5.0" /> PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> PackageReference Include="Plugin.FirebaseAnalytics" Version="4.1.0" /> PackageReference Include="QRCoder" Version="1.4.3" /> PackageReference Include="Xamarin.CommunityToolkit" Version="2.0.0" /> PackageReference Include="Xamarin.Forms" Version="5.0.0.2291" />
      PackageReference Include="Xamarin.Essentials" Version="1.7.1" /> /ItemGroup>

Android project: ItemGroup> PackageReference Include="Com.Airbnb.Xamarin.Forms.Lottie"> Version>4.1.0</Version> /PackageReference> PackageReference Include="Microsoft.AppCenter.Analytics"> Version>4.5.0</Version> /PackageReference> PackageReference Include="Microsoft.AppCenter.Crashes"> Version>4.5.0</Version> PackageReference> PackageReference Include="Microsoft.AppCenter.Distribute"> Version>4.5.0</Version> PackageReference> PackageReference Include="Plugin.FirebaseAnalytics"> Version>4.1.0</Version> PackageReference> PackageReference Include="Square.OkHttp3"> Version>4.9.2.1</Version> PackageReference> PackageReference Include="UXCam"> Version>3.3.0-beta.2</Version> PackageReference> PackageReference Include="Xamarin.Android.Support.v7.AppCompat"> Version>28.0.0.3</Version> PackageReference> PackageReference Include="Xamarin.Forms" Version="5.0.0.2291" /> PackageReference Include="Xamarin.Essentials" Version="1.7.1" /> PackageReference Include="Xamarin.Google.Dagger"> Version>2.39.1</Version> PackageReference> PackageReference Include="Xamarin.GooglePlayServices.Maps"> Version>117.0.1.3</Version> PackageReference> PackageReference Include="Xamarin.GooglePlayServices.MLKit.FaceDetection"> Version>116.1.7.3</Version> PackageReference> ItemGroup> 7. Please enable verbose logging for your app using AppCenter.LogLevel = LogLevel.Verbose before your call to AppCenter.Start(...) and include the logs here: This is log from first try of in-ap update with MIUI optimizations enabled (i only include AppCenterDistribute entries as otherwise it would be too much noise): 03-14 10:07:59.267 30775 30834 D AppCenterDistribute: Distribute workflow will be resumed on activity resume event. 03-14 10:07:59.267 30775 30834 W AppCenterDistribute: Couldn't register receiver due to activity is null. 03-14 10:07:59.621 30775 30775 D AppCenterDistribute: Resume distribute workflow... 03-14 10:07:59.649 30775 30775 D AppCenterDistribute: Get latest release details... 03-14 10:07:59.649 30775 30775 D AppCenterDistribute: Check if we need to report release installation.. 03-14 10:07:59.649 30775 30775 D AppCenterDistribute: Current release was already reported, skip reporting. 03-14 10:07:59.651 30775 30775 D AppCenterDistribute: The receiver for installing a new release was registered. 03-14 10:07:59.622 30775 30775 D AppCenterDistribute: InstallerPackageName=com.google.android.packageinstaller 03-14 10:07:59.649 30775 30775 D AppCenterDistribute: Get latest release details... 03-14 10:07:59.649 30775 30775 D AppCenterDistribute: Check if we need to report release installation.. 03-14 10:07:59.649 30775 30775 D AppCenterDistribute: Current release was already reported, skip reporting. 03-14 10:07:59.651 30775 30775 D AppCenterDistribute: The receiver for installing a new release was registered. 03-14 10:07:59.651 30775 30834 D AppCenterAnalytics: onActivityResumed 03-14 10:07:59.652 30775 30834 D AppCenter: Storing a log to the Persistence database for log type startSession with flags=1 03-14 10:07:59.652 30775 30854 V AppCenterDistribute: Calling https://api.appcenter.ms/v0.1/sdk/apps/****************************fd3aba44/releases/private/latest?release_hash=9de3b7284169a0bfa129a473d9058a05d9b4f81469eb8fedec132dda10b13a67... 03-14 10:07:59.653 30775 30854 V AppCenterDistribute: Headers: {x-api-token=***************************25076d47} 03-14 10:08:00.442 30775 30775 D AppCenterDistribute: Check if latest release is more recent. 03-14 10:08:00.442 30775 30775 D AppCenterDistribute: Latest release more recent=true 03-14 10:08:00.442 30775 30775 D AppCenterDistribute: Release is mandatory, ignoring any postpone action. 03-14 10:08:00.443 30775 30775 D AppCenterDistribute: Latest release is more recent. 03-14 10:08:00.443 30775 30775 D AppCenterDistribute: Show default update dialog. 03-14 10:08:01.826 30775 30775 D AppCenterDistribute: Show new unknown sources dialog. 03-14 10:08:16.947 30775 30775 D AppCenterDistribute: Resetting workflow on entering foreground. 03-14 10:08:16.948 30775 30775 D AppCenterDistribute: Resume distribute workflow... 03-14 10:08:16.949 30775 30775 D AppCenterDistribute: Schedule download... 03-14 10:08:16.950 30775 30933 D AppCenterDistribute: Start downloading new release from https://appcenter-filemanagement-distrib4ede6f06e.azureedge.net/a84a7a53- 03-14 10:08:16.972 30775 30775 V AppCenterDistribute: Already checking or checked latest release. 03-14 10:08:16.972 30775 30775 D AppCenterDistribute: The receiver for installing a new release was registered. 03-14 10:08:17.002 30775 30933 D AppCenterDistribute: Start download *** update. 03-14 10:08:17.012 30775 30854 V AppCenterDistribute: Downloading *** update: 0 KiB / 0 KiB *** omitted noise entries about downloading package *** 03-14 10:08:22.622 30775 30970 D AppCenterDistribute: Download was successful for id=3963 03-14 10:08:22.623 30775 30775 I AppCenterDistribute: Release is downloaded. Starting to install it. 03-14 10:08:22.623 30775 30775 D AppCenterDistribute: Stored release details: group id=7a2c1c50-8947-4c51-aaa9-0daf41d6fb7f release hash=1d6c0aebcd50581d902b75166290d3456be1650ef1fd974ea8c74b1885cf2e99 release id=395 03-14 10:08:22.624 30775 30775 D AppCenterDistribute: Show new system alerts windows dialog. 03-14 10:08:22.695 30775 30970 D AppCenterDistribute: Download was successful for id=3963 03-14 10:08:22.699 30775 30775 I AppCenterDistribute: Release is downloaded. Starting to install it. 03-14 10:08:22.700 30775 30775 D AppCenterDistribute: Stored release details: group id=7a2c1c50-8947-4c51-aaa9-0daf41d6fb7f release hash=1d6c0aebcd50581d902b75166290d3456be1650ef1fd974ea8c74b1885cf2e99 release id=395 03-14 10:08:22.701 30775 30775 D AppCenterDistribute: Previous dialog is still being shown in the same activity. 03-14 10:08:25.814 30775 30775 D AppCenterDistribute: Resetting workflow on entering foreground. 03-14 10:08:25.815 30775 30775 D AppCenterDistribute: Resume distribute workflow... 03-14 10:08:25.815 30775 30775 D AppCenter: Start installing new release... 03-14 10:08:26.815 30775 30775 D AppCenterDistribute: The receiver for installing a new release was registered. 03-14 10:08:27.850 30775 30775 D AppCenterDistribute: The install session was created. 03-14 10:08:27.850 30775 30775 D AppCenterDistribute: Hide the install progress dialog. 03-14 10:08:27.850 30775 30775 D AppCenterDistribute: Show the install progress dialog. 03-14 10:08:27.863 30775 30775 V AppCenterDistribute: Installation progress: 80 / 100. 03-14 10:08:27.863 30775 30775 D AppCenterDistribute: Update the install progress dialog. *** here i include everything that was in device log because next entry indicates failure (log level Info) ***

03-14 10:08:27.863 30775 30775 I Choreographer: Skipped 62 frames! The application may be doing too much work on its main thread. 03-14 10:08:27.866 581 630 I BufferQueue: unnamed-581-22379 BufferQueue core=(581:/system/bin/surfaceflinger) 03-14 10:08:27.866 581 630 I BufferQueueConsumer: unnamed-581-22379 connect(C): consumer=(581:/system/bin/surfaceflinger) controlledByApp=false 03-14 10:08:27.866 581 630 I BufferQueueConsumer: unnamed-581-22379 setConsumerName: unnamed-581-22379 03-14 10:08:27.866 581 630 I BufferQueueConsumer: Installing...#0 setConsumerName: Installing...#0 03-14 10:08:27.866 581 630 I BufferQueueConsumer: Installing...#0 setDefaultBufferSize: width=177 height=177 03-14 10:08:27.868 581 630 I BufferQueueConsumer: Installing...#0 setDefaultBufferSize: width=1200 height=585 03-14 10:08:27.869 514 715 I hwcomposer: [DPY] receive refesh frquest from driver: type[4]
03-14 10:08:27.869 514 715 I hwcomposer: [HWC] fire a callback of refresh to SF
03-14 10:08:27.870 30775 30775 E GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false 03-14 10:08:27.871 30775 30807 D Surface : Surface::connect(this=0x7bc47aa000,api=1) 03-14 10:08:27.871 581 630 I BufferQueueProducer: Installing...#0 connect(P): api=1 producer=(30775:pl.benefitsystems.multisport.dev) producerControlledByApp=false 03-14 10:08:27.872 30775 30807 D mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 03-14 10:08:27.872 30775 30807 D Surface : Surface::setBufferCount(this=0x7bc47aa000,bufferCount=3) 03-14 10:08:27.872 30775 30807 D Surface : Surface::allocateBuffers(this=0x7bc47aa000) 03-14 10:08:27.876 28096 28096 I AssistHolderContentView: forceFitSystemWindows pb = 130 03-14 10:08:27.877 30775 30807 I OpenGLRenderer: Davey! duration=1051ms; Flags=1, IntendedVsync=1365828263833548, Vsync=1365829297339076, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1365829302798635, AnimationStart=1365829302813404, PerformTraversalsStart=1365829303211558, DrawStart=1365829311181789, SyncQueued=1365829311916174, SyncStart=1365829312171635, IssueDrawCommandsStart=1365829312209174, SwapBuffers=1365829314215327, FrameCompleted=1365829315959943, DequeueBufferDuration=762000, QueueBufferDuration=333000, 03-14 10:08:27.878 30775 30775 W Looper : Slow Looper main: doFrame is 1038ms late because of 8 msg, msg 3 took 1000ms (seq=1056 late=869ms h=android.app.ActivityThread$H w=116) 03-14 10:08:27.884 581 630 I BufferQueueProducer: pl.benefitsystems.multisport.dev/crc64eff76824cfcfc7ac.MainActivity#0 queueBuffer: fps=0.96 dur=1036.76 max=1036.76 min=1036.76 03-14 10:08:27.884 581 581 I SurfaceFlinger: screenshot (pl.benefitsystems.multisport.dev/crc64eff76824cfcfc7ac.MainActivity#0) 03-14 10:08:27.884 581 581 I SurfaceFlinger: isIncludeStatusBarAndNavBar (1) 03-14 10:08:27.884 13397 13397 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3210 03-14 10:08:27.885 13397 13397 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2099 checkRepeatedly = false, unlocked = true 03-14 10:08:27.885 30775 30807 I OpenGLRenderer: Davey! duration=1059ms; Flags=1, IntendedVsync=1365828263833548, Vsync=1365829297339076, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1365829302798635, AnimationStart=1365829302813404, PerformTraversalsStart=1365829303211558, DrawStart=1365829316390712, SyncQueued=1365829316624789, SyncStart=1365829316816558, IssueDrawCommandsStart=1365829316884558, SwapBuffers=1365829322019558, FrameCompleted=1365829323975943, DequeueBufferDuration=252000, QueueBufferDuration=1349000, 03-14 10:08:27.885 13397 13397 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1907 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=pl.benefitsystems.multisport.dev fieldId=-1 fieldName=null extras=null}, false) 03-14 10:08:27.886 13397 13397 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2099 checkRepeatedly = true, unlocked = true 03-14 10:08:27.888 30775 30775 D AppCenterDistribute: The installation of the new version is completed with the result: failure. 03-14 10:08:27.892 28096 28096 I AssistHolderContentView: forceFitSystemWindows pb = 130 03-14 10:08:27.900 30775 30775 D AppCenterDistribute: Hide the install progress dialog. 03-14 10:08:27.901 30775 30807 D Surface : Surface::disconnect(this=0x7bc47aa000,api=1) 03-14 10:08:27.902 581 632 I BufferQueueProducer: Installing...#0 disconnect(P): api 1 03-14 10:08:27.902 30775 30775 D View : [Warning] assignParent to null: this = DecorView@ab2f17f[Installing] 03-14 10:08:27.906 30775 30775 D AppCenterDistribute: Failed to install a new release with status: 1. Error message: INSTALL_FAILED_INTERNAL_ERROR: Permission Denied. 03-14 10:08:27.906 30775 30775 D ForceDarkHelper: updateByCheckExcludeList: pkg: pl.benefitsystems.multisport.dev activity: crc64eff76824cfcfc7ac.MainActivity@d39d359 03-14 10:08:27.909 30775 30775 D ForceDarkHelper: updateByCheckExcludeList: pkg: pl.benefitsystems.multisport.dev activity: crc64eff76824cfcfc7ac.MainActivity@d39d359 03-14 10:08:27.909 28096 28096 I AssistHolderContentView: forceFitSystemWindows pb = 130 03-14 10:08:27.910 1304 3408 E InputDispatcher: Window handle Window{82b7add u0 Installing...} has no registered input channel 03-14 10:08:27.912 30775 30775 D AppCenterDistribute: Failed to install a new release with status: 1. Error message: INSTALL_FAILED_INTERNAL_ERROR: Permission Denied. 03-14 10:08:27.920 30775 31017 I OMXClient: IOmx service obtained 03-14 10:08:27.920 763 15774 I OMXMaster: makeComponentInstance(OMX.MTK.VIDEO.ENCODER.AVC) in android.hardwar process 03-14 10:08:27.921 30775 30775 D ViewRootImpl[Toast]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false 03-14 10:08:27.923 1304 1773 E WindowManager: App trying to use insecure INPUT_FEATURE_NO_INPUT_CHANNEL flag. Ignoring

damiand2 avatar Mar 14 '22 09:03 damiand2

Hi @damiand2, thank you for reaching out to us!

Unfortunately, in-app update is not working with MIUI optimizations enabled. As for the issue when you are not able to install an update second time, it is a known issue. See the original thread: https://github.com/microsoft/appcenter-sdk-android/issues/1594.

sergei-fedorov avatar Mar 16 '22 08:03 sergei-fedorov

Hi @sergei-fedorov - workaround looks promising, however, is there a way to access that API using xamarin.forms nuget? or i have to do bindings library for aar? As for MIUI - are there any plans to make it work there? (I just want to add here that previous versions of Appcenter Distribute worked on MIUI perfectly so this statement is a complete suprise to me)

damiand2 avatar Mar 16 '22 10:03 damiand2

as a workaround i downgraded appcenter nugets to 4.4.0 and solves both issues for now (MIUI and upgrade-after-upgrade)

damiand2 avatar Mar 17 '22 08:03 damiand2

Hi @damiand2 ,

workaround looks promising, however, is there a way to access that API using xamarin.forms nuget

Unfortunately the workaround would work for Android native app only.

As for MIUI - are there any plans to make it work there?

We will investigate it once we get a specific device that we can reproduce the issue on. Marking it as a bug.

DmitriyKirakosyan avatar Mar 21 '22 03:03 DmitriyKirakosyan

I have noticed the same bug as described here Original android bug

I'm using SDK version 4.5.0 in MAUI application and I'm testing on Samsung Galaxy phones. My phone does not have MIUI optimizations

rborosak avatar Mar 24 '22 08:03 rborosak

@rborosak - you can use workaround for now as described above

damiand2 avatar Mar 24 '22 10:03 damiand2

@damiand2 I cannot.. If I downgrade nuget package to any version lower then v.4.5.0 the build fails in my MAUI app. I get MSB6006 "java.exe" exited with code 1. It seems there is a problem with manifest merger. For now I'm stuck util this bug is fixed

rborosak avatar Mar 24 '22 11:03 rborosak

@damiand2 , replied in #1634.

DmitriyKirakosyan avatar Mar 27 '22 10:03 DmitriyKirakosyan

Hi @damiand2 , we have just released a new version of DotNet SDK 4.5.1. Could you please test your scenario on the new version and check if it works?

DmitriyKirakosyan avatar Apr 28 '22 07:04 DmitriyKirakosyan

hi @DmitriyKirakosyan - i just checked. Unfortunately problem is still there.

damiand2 avatar Apr 28 '22 14:04 damiand2

The issue is fixed in 4.5.3. Closing.

DmitriyKirakosyan avatar Aug 18 '22 11:08 DmitriyKirakosyan