Open Closed

Android app errors on ShellViewModel.UpdatePermissions() #6962


User avatar
0
darutter created
  • ABP Framework version: v8.0.4
  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Create a .NET MAUI app using .NET 8.0 and ABP 8.0.4. Create Android archive and publish play store. Download app and run. App hangs at splash screen and throws the following exception:

The image is from Sentry monitoring.

The IAbpAuthorizationService is implemented by default (no changes from the code generated by template). I need to know how to resolve this issue and get my android version of the app working properly.


9 Answer(s)
  • User Avatar
    0
    darutter created

    Do you have any ideas on how to solve this???

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Probably it happens because of SecureStorage

    Have you configured it for production for each platform?

    You have to take some action on your device, you can try following this topic: https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/secure-storage?view=net-maui-8.0&tabs=android

  • User Avatar
    0
    darutter created

    I followed the link you provided and added the exclusion file for the backup as suggested and the app now crashes immediately after showing the splash screen. Are there recommended settings in the manifest or other areas of the android app that I need to check? The iOS version of the app works fine.

  • User Avatar
    0
    darutter created

    I updated the .csproj file to force the use of the interpreter in release mode for both the iOS and android versions of the app. Again, the iOS version runs successfully when deployed to TestFlight but the Android version now never gets past the splash screen. I've looked in SO for solutions but found none. Are you able to provide ANY assistance??

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try replacing SecureStorage with Preferences to check if it is a problem with SecureStorage.

    https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/preferences?view=net-maui-8.0&tabs=android If so, Maybe you didn't configure the Android part correctly

  • User Avatar
    0
    darutter created

    In the UpdatePermissions method I have removed the calls to AuthorizationService.IsGrantedAsync() and replaced them with just setting the properties to true as follows:

    HasUsersPermission = true; // await AuthorizationService.IsGrantedAsync(IdentityPermissions.Users.Default); HasTenantsPermission = true; // await AuthorizationService.IsGrantedAsync(SaasHostPermissions.Tenants.Default);

    As in my previous post, the app never gets past the splash screen.

    These are the items in the MainApplication.cs file:

    [assembly: UsesPermission(Android.Manifest.Permission.ReadExternalStorage, MaxSdkVersion = 32)]
    [assembly: UsesPermission(Android.Manifest.Permission.ReadMediaAudio)]
    [assembly: UsesPermission(Android.Manifest.Permission.ReadMediaImages)]
    [assembly: UsesPermission(Android.Manifest.Permission.ReadMediaVideo)]
    
    // Needed for Taking photo/video
    [assembly: UsesPermission(Android.Manifest.Permission.Camera)]
    [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage, MaxSdkVersion = 32)]
    
    // Add these properties if you would like to filter out devices that do not have cameras, or set to false to make them optional
    [assembly: UsesFeature("android.hardware.camera", Required = true)]
    [assembly: UsesFeature("android.hardware.camera.autofocus", Required = true)]
    
    This is the annotation for the MainActivity.cs:
    [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
     This is the annotations for the WebAuthenticatorCallbackActivity.cs
    
    [Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop, Exported =true)]
    [IntentFilter(new[] { Intent.ActionView },
        Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
        DataScheme = CALLBACK_SCHEME)]
    

    In the MauiModule.cs file I am doing the following:

    I didn't find anything in the link you sent me that gives any information about configuring the android portion of the project for using secure storage, and like I said, in the latest version that I tried I have removed the references that were originally giving the exception. Now I just get an "Application Not Responding" error.

    Do you have any further suggestions or insights?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    In the MauiModule.cs file I am doing the following:

    The GetInsecureHandler method is only used in debug mode by default.

    You can try to remove the #if DEBUG code block

  • User Avatar
    0
    darutter created

    I have tried everything suggested. I even updated to 8.0.5. I can't even run it in debug mode. I am getting a java.cert.certificateexception in this app and another app that are both built on abp.io commercial 8.0.5

    Again these apps run fine in iOS. I need to understand why these issues persist with this framework.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you share the code of MauiModule class?

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11