- 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.
20 Answer(s)
-
0
Do you have any ideas on how to solve this???
-
0
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
-
0
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.
-
0
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??
-
0
Hi,
You can try replacing
SecureStorage
withPreferences
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
-
0
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?
-
0
-
0
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.
-
0
Hi,
Could you share the code of
MauiModule
class? -
0
Here is the code. The project references the API that is housed on Azure App Services which is why the cert issuer is from Azure.
using IdentityModel; using IdentityModel.OidcClient; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using MyProject.Localization; using MyProject.Maui.Oidc; using Volo.Abp.Account.Localization; using Volo.Abp.Autofac; using Volo.Abp.Http.Client; using Volo.Abp.Http.Client.IdentityModel; using Volo.Abp.Identity.Localization; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.Security.Claims; using Volo.Abp.Validation.Localization; using Volo.Saas.Localization; using Volo.Abp.Maui.Client; namespace MyProject.Maui; [DependsOn( typeof(AbpAutofacModule), typeof(AbpMauiClientModule), typeof(AbpHttpClientIdentityModelModule), typeof(MyProjectHttpApiClientModule) )] public class MyProjectMauiModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { PreConfigure<AbpHttpClientBuilderOptions>(options => { options.ProxyClientBuildActions.Add((_, clientBuilder) => { clientBuilder.ConfigurePrimaryHttpMessageHandler(GetInsecureHandler); }); }); } public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); MapClaimTypes(); ConfigureOidcClient(context, configuration); ConfigureLocalization(); } private void ConfigureOidcClient(ServiceConfigurationContext context, IConfiguration configuration) { Configure<OidcClientOptions>(configuration.GetSection("Oidc:Options")); context.Services.AddTransient<OidcClient>(sp => { var options = sp.GetRequiredService<IOptions<OidcClientOptions>>().Value; options.Browser = sp.GetRequiredService<MauiAuthenticationBrowser>(); options.BackchannelHandler = GetInsecureHandler(); return new OidcClient(options); }); } private void ConfigureLocalization() { Configure<AbpLocalizationOptions>(options => { options.Resources .Get<Simul_BCFOResource>() .AddBaseTypes(typeof(AbpValidationResource)) .AddBaseTypes(typeof(IdentityResource)) .AddBaseTypes(typeof(AccountResource)) .AddBaseTypes(typeof(SaasResource)); }); Configure<AbpLocalizationOptions>(options => { options.Languages.Add(new LanguageInfo("ar", "ar", "العربية", "ae")); options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština")); options.Languages.Add(new LanguageInfo("en", "en", "English")); options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)")); options.Languages.Add(new LanguageInfo("hu", "hu", "Magyar")); options.Languages.Add(new LanguageInfo("fi", "fi", "Finnish", "fi")); options.Languages.Add(new LanguageInfo("fr", "fr", "Français", "fr")); options.Languages.Add(new LanguageInfo("hi", "hi", "Hindi", "in")); options.Languages.Add(new LanguageInfo("it", "it", "Italiano", "it")); options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); options.Languages.Add(new LanguageInfo("ru", "ru", "Русский", "ru")); options.Languages.Add(new LanguageInfo("sk", "sk", "Slovak", "sk")); options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe")); options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文")); options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsch", "de")); options.Languages.Add(new LanguageInfo("es", "es", "Español")); }); } //https://docs.microsoft.com/en-us/xamarin/cross-platform/deploy-test/connect-to-local-web-services#bypass-the-certificate-security-check private static HttpMessageHandler GetInsecureHandler() { #if ANDROID var handler = new HttpClientHandler() { UseCookies = false }; handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { if (cert is { Issuer: "CN=Microsoft Azure TLS Issuing CA 02, O=Microsoft Corporation, C=US" }) { return true; } return errors == System.Net.Security.SslPolicyErrors.None; }; return handler; #elif IOS var handler = new NSUrlSessionHandler { UseCookies = false, TrustOverrideForUrl = (sender, url, trust) => url.StartsWith("https://simul") }; return handler; #elif WINDOWS || MACCATALYST return new HttpClientHandler() { UseCookies = false }; #else throw new PlatformNotSupportedException("Only Android, iOS, MacCatalyst, and Windows supported."); #endif } private static void MapClaimTypes() { AbpClaimTypes.UserName = JwtClaimTypes.PreferredUserName; AbpClaimTypes.Name = JwtClaimTypes.GivenName; AbpClaimTypes.SurName = JwtClaimTypes.FamilyName; AbpClaimTypes.UserId = JwtClaimTypes.Subject; AbpClaimTypes.Role = JwtClaimTypes.Role; AbpClaimTypes.Email = JwtClaimTypes.Email; } }
-
0
Hi,
It looks like a cert problem.
Will this can help you?
https://github.com/dotnet/maui/discussions/8131#discussioncomment-2971214
-
0
-
0
I updated my Volo.Abp packages this morning and am now getting a new set of errors:
you need to rebuild, try
dotnet clean & abp clean
. -
0
I did the refresh and rebuild after updating to version 8.1.1 of abp and I am getting an error when I deploy the app stating that it can't find Microsoft.AspNetCore.Mvc.Versioning version 5.1.0. This package has been deprecated and should not be referenced. Is there one of the Volo packages that is still referencing it, because there is nothing listed in the projects that has it listed?
-
0
Hi,
No, ABP no longer uses package
Microsoft.AspNetCore.Mvc.Versioning
You must ensure all the ABP packages are upgraded to 8.1.1, and the LeptonX theme version is 3.1.x
-
0
I continue to have the issue with the Cert error. This has not been an issue with previous versions of abp.io.
-
0
Hi,
Sorry for late, Now it doesn't work locally either?
-
0
Again, I have 2 apps that are built on the 8.0.x framework and neither of these app will run using the Android version locally. Both generate the same Java.Cert.CertificationException. I have used the abp.io commercial framework for 3 years but with the latest releases I have had more problems getting a working version of my MAUI apps. I have gotten the iOS versions of the apps to compile and run successfully without any certification exceptions, but the Android versions are failing.
I get the Cert exception and then get an Autofac exception:
These occur immediately after the splash screen is displayed.
-
0
Hi,
Sorry for that.
Will this can help you?
using IdentityModel; using IdentityModel.OidcClient; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using MyProject.Localization; using MyProject.Maui.Oidc; using Volo.Abp.Account.Localization; using Volo.Abp.Autofac; using Volo.Abp.Http.Client; using Volo.Abp.Http.Client.IdentityModel; using Volo.Abp.Identity.Localization; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.Security.Claims; using Volo.Abp.Validation.Localization; using Volo.Saas.Localization; using Volo.Abp.Maui.Client; namespace MyProject.Maui; [DependsOn( typeof(AbpAutofacModule), typeof(AbpMauiClientModule), typeof(AbpHttpClientIdentityModelModule), typeof(MyProjectHttpApiClientModule) )] public class MyProjectMauiModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { PreConfigure<AbpHttpClientBuilderOptions>(options => { options.ProxyClientBuildActions.Add((_, clientBuilder) => { clientBuilder.ConfigurePrimaryHttpMessageHandler(GetInsecureHandler); }); }); } public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); MapClaimTypes(); ConfigureOidcClient(context, configuration); ConfigureLocalization(); } private void ConfigureOidcClient(ServiceConfigurationContext context, IConfiguration configuration) { Configure<OidcClientOptions>(configuration.GetSection("Oidc:Options")); context.Services.AddTransient<OidcClient>(sp => { var options = sp.GetRequiredService<IOptions<OidcClientOptions>>().Value; options.Browser = sp.GetRequiredService<MauiAuthenticationBrowser>(); options.BackchannelHandler = GetInsecureHandler(); return new OidcClient(options); }); } private void ConfigureLocalization() { Configure<AbpLocalizationOptions>(options => { options.Resources .Get<Simul_BCFOResource>() .AddBaseTypes(typeof(AbpValidationResource)) .AddBaseTypes(typeof(IdentityResource)) .AddBaseTypes(typeof(AccountResource)) .AddBaseTypes(typeof(SaasResource)); }); Configure<AbpLocalizationOptions>(options => { options.Languages.Add(new LanguageInfo("ar", "ar", "العربية", "ae")); options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština")); options.Languages.Add(new LanguageInfo("en", "en", "English")); options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)")); options.Languages.Add(new LanguageInfo("hu", "hu", "Magyar")); options.Languages.Add(new LanguageInfo("fi", "fi", "Finnish", "fi")); options.Languages.Add(new LanguageInfo("fr", "fr", "Français", "fr")); options.Languages.Add(new LanguageInfo("hi", "hi", "Hindi", "in")); options.Languages.Add(new LanguageInfo("it", "it", "Italiano", "it")); options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); options.Languages.Add(new LanguageInfo("ru", "ru", "Русский", "ru")); options.Languages.Add(new LanguageInfo("sk", "sk", "Slovak", "sk")); options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe")); options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文")); options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsch", "de")); options.Languages.Add(new LanguageInfo("es", "es", "Español")); }); } //https://docs.microsoft.com/en-us/xamarin/cross-platform/deploy-test/connect-to-local-web-services#bypass-the-certificate-security-check private static HttpMessageHandler GetInsecureHandler() { #if ANDROID var handler = new HttpClientHandler() { UseCookies = false }; handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { var handler = new HttpClientHandler() { UseCookies = false }; handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { if(cert.Issuer == "CN=localhost" || cert.Issuer == "CN=Microsoft Azure TLS Issuing CA 02, O=Microsoft Corporation, C=US") { return true; } // Or always return true for test. return errors == System.Net.Security.SslPolicyErrors.None; }; return handler; #elif IOS var handler = new NSUrlSessionHandler { UseCookies = false, TrustOverrideForUrl = (sender, url, trust) => url.StartsWith("https://simul") }; return handler; #elif WINDOWS || MACCATALYST return new HttpClientHandler() { UseCookies = false }; #else throw new PlatformNotSupportedException("Only Android, iOS, MacCatalyst, and Windows supported."); #endif } private static void MapClaimTypes() { AbpClaimTypes.UserName = JwtClaimTypes.PreferredUserName; AbpClaimTypes.Name = JwtClaimTypes.GivenName; AbpClaimTypes.SurName = JwtClaimTypes.FamilyName; AbpClaimTypes.UserId = JwtClaimTypes.Subject; AbpClaimTypes.Role = JwtClaimTypes.Role; AbpClaimTypes.Email = JwtClaimTypes.Email; } }
-
0
Microsoft changed the signature of the issuer from what it originally was and that caused the cert error.