Troubleshooting .NET Maui
Troubleshooting Steps
Check this page first for common issues based on .NET Setup.
For Android and/or iOS Platform issues see:
Try the example project on our Github repository.
If stuck, contact support directly or email [email protected] for help.
For faster assistance, please provide:
- Your OneSignal App Id
- Details, logs, and/or screenshots of the issue.
- Steps to reproduce
Error: "Could not find part of path"
This issue is related to the path name limit on Windows, that limit is 260 characters. This can be resolved in one of two ways :
- Changing file names in the path so they no longer exceed the character limit
- Enabling long path support following this guide from Microsoft
Android troubleshooting
Java 65K dex limit errors when building
This error occurs due to the number of Java libraries included in your project.
-
Check for Unnecessary Libraries
- Ensure you are not including unnecessary libraries under References or NuGet Packages.
- Open your .csproj file and review the PackageReferences section to remove any libraries that are not essential to your project.
-
Enable ProGuard (Code Shrinking and Obfuscation)
ProGuard reduces the size of your application by removing unused code and minimizing the number of methods referenced.- How to enable ProGuard in Visual Studio Code
- Open your project in VS Code.
- Edit the Android-specific properties in the .csproj file. Add the following properties under the related to the Android build
<AndroidEnableProguard>true</AndroidEnableProguard>
-
Save the file and rebuild your Android project by running the following command in the terminal:
dotnet build -t:Run -f net8.0-android
- Enable Multi-Dex (Handling the 65K Method Limit)
If enabling ProGuard doesn't resolve the issue, you will need to enable Multi-Dex support, which allows Android to split your app’s code into multiple dex files to bypass the method limit.- How to enable Multi-Dex in Visual Studio Code
- In the same .csproj file, add the following properties under
<AndroidEnableMultiDex>true</AndroidEnableMultiDex> <AndroidDexTool>d8</AndroidDexTool>
- Save the file and rebuild your project using the same build command
iOS troubleshooting
Crash on splash screen
This has been reported when updating the SDK from version 5.1 to 5.2
- Delete your bin and obj folders in your project.
- From your terminal, run a
dotnet clean
from the directory containing your project. - Try building the project again, ensuring the dependencies are all on the correct versions you intended to update to.
Adding the notification service extension for iOS
.NET Maui will not automatically create a Notification Service Extension target in your iOS project. To add this, we recommend adding a package like DotNet Templates with NuGet in order to create the extension for your project.
For Xamarin troubleshooting
With Microsoft dropping support for Xamarin, the OneSignal Xamarin SDK is no longer receiving updates or maintenance going forward. See version 9 of the documentation for the Xamarin set up guide and troubleshooting. Microsoft has shared a guide on migrating to .NET from Xamarin here.
Updated about 1 month ago