android – How to add advertising in .Net Maui?


I’m developing in .Net Maui, .Net 7.0, Windows 11 with Visual Studio 2022 17.8.0.
I’m trying to add ads from Google AdMob in my project.

I use ‘Plugin.MauiMTAdmob 1.0.4’. I was able to install it and works for Android but not for iOS.
For iOS, the plugin uses “Xamarin.Firebase.iOS.Core” as a dependency but is impossible to use. “Xamarin.Firebase.iOS.Core” has a long path inside and the editor cannot work.

this is the error I get while compiling:

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\g\AppData\Local\Temp\Xamarin\HotRestart\Signing\MauiAds.app\out\Payload\MauiAds.app\MauiAds.content\Firebase.Core.resources\FirebaseCoreDiagnostics.xcframework\ios-arm64_x86_64-simulator\FirebaseCoreDiagnostics.framework\Headers\FIRCoreDiagnostics.h'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.Compression.ZipFileExtensions.DoCreateEntryFromFile(ZipArchive destination, String sourceFileName, String entryName, Nullable`1 compressionLevel)
   at System.IO.Compression.ZipFile.DoCreateFromDirectory(String sourceDirectoryName, String destinationArchiveFileName, Nullable`1 compressionLevel, Boolean includeBaseDirectory, Encoding entryNameEncoding)
   at Xamarin.iOS.Windows.Installer.ApplicationSession.CreateIpa(String appName, String appPath, String targetPath) in D:\a\_work\1\s\src\Tools\Xamarin.iOS.Windows.Client\Installer\ApplicationSession.cs:line 238
   at Xamarin.iOS.Windows.Installer.ApplicationSession.Deploy(String appRootFolder, String appBundleId, String appName) in D:\a\_work\1\s\src\Tools\Xamarin.iOS.Windows.Client\Installer\ApplicationSession.cs:line 91
   at Xamarin.iOS.Windows.HotRestartClient.Deploy(AppleDevice nativeDevice, String appBundleId, String appBundleName, Boolean& incremental) in D:\a\_work\1\s\src\Tools\Xamarin.iOS.Windows.Client\HotRestartClient.cs:line 250

I also find this problem open here, but none of these solutions worked for me.

What is the best solution? I should try to use another advertising provider? If yes, do you know how canI do it?

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img