Xamarin Android project runtime error Firebase library - firebase

We are trying to integrate to Azure notification hub in xamarin forms project. Added the below nuget packages and implemented the classes but while running the application , getting the below error. We are not using any code shrinker but still getting this error. Any help would be appreciated.
Xamarin.GooglePlayServices.Base
Xamarin.Firebase.Messaging
Xamarin.Azure.NotificationHubs.Android
''Java.Lang.RuntimeException: 'Unable to get provider com.google.firebase.provider.FirebaseInitProvider: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.firebase.messaging.FirebaseMessaging]>{1, type=0, deps=[Dependency{anInterface=class com.google.firebase.FirebaseApp, type=required, direct=true}, Dependency{anInterface=interface com.google.firebase.installations.FirebaseInstallationsApi, type=required, direct=true}, Dependency{anInterface=class com.google.firebase.iid.FirebaseInstanceId, type=required, direct=true}, Dependency{anInterface=interface com.google.firebase.platforminfo.UserAgentPublisher, type=required, direct=true}, Dependency{anInterface=interface com.google.android.datatransport.TransportFactory, type=optional, direct=true}, Dependency{anInterface=interface com.google.firebase.heartbeatinfo.HeartBeatInfo, type=required, direct=true}]}: interface com.google.firebase.installations.FirebaseInstallationsApi''

This error was because I missed adding these permissions in manifest.
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
Now the issue is that the OnNewToken method in FirebaseMessagingservice is not getting invoked. Tried reinstalling as well. Any thoughts on this?

Related

The Module DLL C:\Program Files\IIS\Asp.Net Core Module\V2\apnetcorev2.dll failed to load. The data is the error

I have recently update an aspnetcore project from .NET Core 2.1 to .NET 6.0.
Since the update, the application will not run in IIS 10.0.
When I attempt to run the application, the application pool exits, and I see the following error in the Event Viewer:
Log Name: Application
Source: Microsoft-Windows-IIS-W3SVC-WP
Date: 1/18/2023 10:37:14 AM
Event ID: 2280
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: MACHINENAME.dev.oati.local
Description:
The Module DLL C:\Program Files\IIS\Asp.Net Core Module\V2\apnetcorev2.dll failed to load. The data is the error.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-IIS-W3SVC-WP" Guid="{670080D9-742A-4187-8D16-41143D1290BD}" EventSourceName="W3SVC-WP" />
<EventID Qualifiers="49152">2280</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2023-01-18T16:37:14.436510400Z" />
<EventRecordID>368815</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>MACHINENAME.dev.oati.local</Computer>
<Security />
</System>
<EventData>
<Data Name="ModuleDll">C:\Program Files\IIS\Asp.Net Core Module\V2\apnetcorev2.dll</Data>
<Binary>7E000000</Binary>
</EventData>
</Event>
I have installed the relevant Windows Hosting Bundle:
I have installed the relevant Microsoft Visual C++ Redistributable:
I'm not sure what to check next. I have gone through multiple similar stackoverflow questions, as well as the aspnetcore github issues list and have not gotten a good idea of what to look at next to debug the issue.
EDIT:
Here is the Jexus Manager output for the application --
So it says ASP.NET Core module version 2 is not installed properly.
It is not clear to me why that would be the case, or how to remedy it.

publish task in devops pipeline failing with Import Project not found error

getting this error during the publish task of my pipeline to deploy a webapp : D:\a\1\s\LDTUTMVMAutoApp.csproj(263,3): error MSB4019: The imported project "C:\hostedtoolcache\windows\dotnet\sdk\5.0.300\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\hostedtoolcache\windows\dotnet\sdk\5.0.300\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.
I assume it might have something to do with the imports in my *.csproj file?
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
Full error message
This is due to the wrong choice of your build task. Your project is Web app based on .net framework instead of .net core, so the dotnet build task used cannot find the web target file corresponding to the web app in the .net core directory.
You can use msbuild task or visual stuido build task instead.

error APT2263: unexpected element <queries> found in <manifest>

First I beg your pardon if the problem sounds silly, but I'm a newbie in Xamarin.Forms development.
I created my first app (with a lot of efforts) and I decided to use AppCenter to deploy debug releases to my testers.
Everything went fine till the last month, when I updated packages (dependencies), removed some deprecated one and pushed changes to GIT: from that moment AppCenter can't compile my app anymore, app that's compiled properly on my pc.
If I compile using v10.0 this is the error I get:
/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/StamuraApp.Android.csproj"
(PackageForAndroid target) (1) -> (_CreateBaseApkWithAapt2 target) ->
/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/obj/Release/android/manifest/AndroidManifest.xml(31):
error APT2263: unexpected element <queries> found in <manifest>.
[/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/StamuraApp.Android.csproj]
If I try to compile using v11.0 I get the error:
/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/StamuraApp.Android.csproj"
(PackageForAndroid target) (1) -> (_ResolveSdks target) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(819,2):
error XA0000: Could not determine API level for $(TargetFrameworkVersion) of 'v11.0'.
[/Users/runner/work/1/s/src/StamuraApp/StamuraApp.Android/StamuraApp.Android.csproj]
So I understand that AppCenter can't use v11.0, but I don't know what to do with the error.
I searched other questions and most of them talk about Gradle version, but I don't know how to set it in Visual Studio.
AppCenter warns me that
Usage of Android Gradle Plugin 4.1.0+ is not supported at the moment.
Please use any of the earlier versions.
but I don't know how I can solve it.
Is there a way I can fix the issue?
EDITED
My manifest is this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="156" android:versionName="1.10.6" package="com.sefstamura.stamuraapp" android:installLocation="auto">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Push notifications
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
****************** -->
<application android:label="StamuraApp" android:fullBackupContent="#xml/appcenter_backup_rule">
<!-- File provider -->
<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
</manifest>
Faced the same issue when I tried to Upgrade My FormsApp to use XamarinForms to 5.0.
Please make sure to install the latest SDK versions on your machine i.e in my case Android 11[API 30]and corresponding build tool versions.
Also, upgrade the VisualStudio to the latest version where the XamarinAndroidSDK version in turn updated to pick the API level it supports.

Wix Installer Heat.exe error Parameter "exePath" is invalid

I am building a self-contained .Net Core worker service which I run as a windows service. Now I want to create an installe using Wix, however when I try to harvest all the needed DLL's for installation I get the following error:
An error occurred loading a configuration file: The parameter 'exePath' is invalid.
I've read this post which states the heat.exe might be broken. But I downloaded the tools via NuGet (3.11.2) which should theoretically be fine. My Beforebuild target looks as following:
<Exec Command="dotnet publish ..\Parlando.PVS.PackingSlipService\Parlando.PVS.PackingSlipService.csproj -c $(Configuration) -r win10-x86" />
<ItemGroup>
<LinkerBindInputPaths Include="%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(Configuration)\%(ProjectReference.TargetFrameworkIdentifier)\win10-x86\publish" />
</ItemGroup>
<HeatDirectory
DirectoryRefId="INSTALLFOLDER"
OutputFile="$(ProjectDir)\HeatGeneratedFileList.wxs"
Directory="..\Parlando.PVS.PackingSlipService\bin\Release\netcoreapp3.1\win10-x86\publish"
ComponentGroupName="HeatGenerated"
ToolPath="$(WixToolPath)"
AutogenerateGuids="True"
SuppressCom="True"
SuppressRegistry="True"
SuppressFragments="True"
SuppressRootDirectory="True"
NoLogo="true" />
<ItemGroup>
<Compile Include="$(ProjectDir)\HeatGeneratedFileList.wxs" Condition="'%(ProjectReference.IsDotnetSDKProject)' == 'True'" />
</ItemGroup>
This should generate a .wxs file that I reference in the Product.wxs file when installing the service. My product.wxs does so as followed:
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="Parlando.PVS.PackingSlipService"
DisplayName="Parlando.PVS.PackingSlipService"
Description="Service installed by Parlando to create packingslips and invoices."
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
<ServiceControl
Id="ServiceInstaller"
Start="install"
Stop="both"
Remove="uninstall"
Name="Parlando.PVS.PackingSlipService" />
</Component>
<ComponentRef Id="HeatGenerated" />
How can i use the heat.exe in such a way that I can access the DLL list in my Product.wxs and install my service via MSI?
Apperantly this error has nothing to do with the provided settings for the Wix installer, but rather the machine that Wix is installed on.
After testing my program on a different machine, all worked fine.

Permissions issue using MSBuild extension pack and IIS7 tasks

im trying to use the iis7 web task in the extension pack. I cant successful use the task(with my god level admin access), but my issue is that i cant use it with the user that must run it (service user).
<Target Name="CheckForSite">
<Message Text="Site: $(Site)" />
<Message Text="Application: $(Application)" />
<Message Text="Server: $(Server)" />
<Message Text="PhysicalPath: $(PhysicalPath)"/>
<!-- Check if the site exists -->
<MSBuild.ExtensionPack.Web.Iis7Website TaskAction="CheckExists"
Name="$(Site)"
MachineName="$(Server)"
>
<Output TaskParameter="Exists" PropertyName="SiteExists"/>
</MSBuild.ExtensionPack.Web.Iis7Website>
<Message Text="Site Exists: $(SiteExists)" Condition="$(SiteExists)"/>
<Message Text="Site does not exist: $(SiteExists)" Condition="(!$(SiteExists))"/>
I get the error:
error : UnauthorizedAccessException: Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine failed due to the following error: 80070005
It is access denied exception. Try to add Username="username" UserPassword="password" properties into the MSBuild.ExtensionPack.Web.Iis7Website task. User should be admin on the target machine.
In my case I had a problem with domain communication. My server is in the different domain as my user's domain. It was fixed by our infrastructure team. I found this issue in the event log. Check event logs first for any related issues.

Resources