Xamarin App not compiling after Xamarin Update - c#

We have a Xamarin app running smoothly, but after latest update to Xamarin and Android Packages, we started receiving this error, the update changed Android Support version from 25.1.0 to 25.1.1:
Error: package android.support.v7.media.RemotePlaybackClient does not exist
check detail of error :
/Users/abd/Programming/Gits/Rental/Rental/Rental/Rental.Droid/obj/Debug/android/src/mono/android/support/v7/media/RemotePlaybackClient_OnMessageReceivedListenerImplementor.java(48,48): Error: error: package android.support.v7.media.RemotePlaybackClient does not exist
android.support.v7.media.RemotePlaybackClient.OnMessageReceivedListener
warning: unknown enum constant Scope.LIBRARY_GROUP
reason: class file for android.support.annotation.RestrictTo$Scope not found
Adding Xamarin.Android.Support.v7.MediaRouter and Xamarin.Android.Support.Media.Compat didn't solve the problem.

For these sort of errors the safest option is to do the following:-
1) Gather a list of all the installed packages with their versions.
2) Remove all packages. Some packages will require removing other packages first.
3) Install all packages again.

check dependencies for both packages.packageandroid.support.v7.media.RemotePlaybackClient,Xamarin.Android.Support.v7.MediaRouter because most of time dependecies should be updated.

go to the nuget package manager and select all the package and push the Update butron in top of the page
Point: There are two update button

Related

Google Firestore error getting database instance

I am trying to add information to my firebase project using Xamarin android app but all of a sudden I got this message:
Error Message
Java.Lang.NoClassDefFoundError
Message=Failed resolution of: Lcom/google/common/base/Preconditions;
My GetDatabase method:
Imgur Link
NuGet Packages Installed:
Xamarin.Android.Support.Core.Utils (ver 28.0.0.3)
Xamarin.Android.Support.CustomTabs (ver 28.0.0.3)
Xamarin.Android.Support.Design (ver 28.0.0.3)
Xamarin.Android.Support.Media.Compat (ver 28.0.0.3)
Xamarin.AndroidX.MultiDex (ver 2.0.1.4)
Xamarin.Essentials (ver 1.5.3.2)
Xamarin.Firebase.Auth (ver 71.1605.4)
Xamarin.Firebase.Firestore (ver 71.1705.4)
Xamarin.Google.Guava (ver 28.2.0)
Xamarin.GooglePlayServices.Auth (ver 71.1600.4)
XamarinLibrary.Xamarin.Android.Support.Multidex (ver 1.0.3)
Debug Log
https://paste.ubuntu.com/p/TDNGwSTDTG/
I tried to paste it here as text but it didn't like it :( ^^
I have tried to rebuild the project on multiple occasions after each change
As I saw in this site in a similar question I tried to downgrade Guava to 27.1.0.0 as well as 27.1.0.4
Double checked the connection to google. I can confidently say so since I have implemented a firebase auth Google sign in option and it works as intented.
I am quite new to Xamarin and Firebase so please don't stone me xD
There is a well known conflict beetween Guava, Xamarin.Firebase and AndroidX.
In my case I implemented AndroidX at the end as a new update, so I already had all the logistic configured with Firebase so the fastest, easiest and (for me) the best solution was to stop using AndroidX and start uninstalling all AndroidX package. (Let me tell you, it was a lot.)
It wasn't easy because even some of the last updates from Guava or Xamarin.Firebase if I recall correctly, depends on AndroidX so I recommend to check that before you update your Nuget packages.
So, long story short, my solution was to stop using AndroidX Nuget package.
At least until this issue got fix.

Unity ML Agents Package Manager is not importing Actuator script

I want to test the Unity ML example "3D Ball". So, I set up environment:
Imported the ML Agents Package by Unity Package Manager.
Copied the ML Agent example Assets from Unity's official GitHub to My Project File.
Then, I opened the example scene and played that scene. But every code which contains "using Unity.MLAgents.Actuators" fails with the following error:
Assets\test.cs(5,22): error CS0234: The type or namespace name 'Actuators' does not exist in the namespace 'Unity.MLAgents' (are you missing an assembly reference?)
So, I've tried to find MLAgents.Actuator module's source code. But I didn't find anything yet.
Someone said Actuator Module is applied after ML Agent 1.0.3, but I imported the lasted version (v. 1.0.4).
How can I import the ML Agents package properly? Every YouTube tutorial does not show the problem I've encountered.
Here is my environment:
Unity version: Unity 2020.1.0f
ML Agents version: version 1.0.4
ML Agents example: version Release 7
Update the package to a 1.4.0-preview or later (depending on your Unity version, you may need to change some package manager settings to be able to see preview packages).
Get the examples from a tag that corresponds to the 1.0.x package, for example com.unity.ml-agents_1.0.6
You have to manually install it from the repository you cloned.
I added the project from "Unity Hub" rather than inserting asset folder to a new project.
And then everything works fine. Even the preview packages like
[com.unity.ml-agents.extensions": "file:../../com.unity.ml-agents.extensions]
added automatically to the project from my project directory!
If you need to use the 1.0.x pacakage, make sure you're getting the examples from a compatible version (not the master branch). For example, here's the 1.0.2 tag: github.com/Unity-Technologies/ml-agents/tree/…. Looks like 1.03 and 1.0.4 tags are missing but I'll update them tomorrow. – celion Sep 27 '20 at 20:27
Celion had the right answer
I have the same problem, I am very new to Unity. I figured out it is something with the versioning. You need to use the proper version of the package. By installing from the Unity Registry, I was not able to install the last version.
I just install the package from the Disk. Here follow the Install the com.unity.ml-agents Unity package. It fixed my problem.
Unity.MLAgents.Actuators this package is in preview till this date, if you want to use this package you need to update your MLAgents package from package manager.

Ignore inaccessible sources w/ dotnet add package

When I try to add a NuGet package via the dotnet cli I get an error that it can't access one of my custom NuGet sources. Is there a way to say "I don't care, restore from where you can"?
McMaster.Extensions.CommandLineUtils clearly it exists in NuGet.org and it finds it but then stops b/c it can't access a custom source 🤷‍♂️.
PS c:\Temp\blah-project> dotnet add package McMaster.Extensions.CommandLineUtils
info : Adding PackageReference for package 'McMaster.Extensions.CommandLineUtils' into project 'c:\Temp\blah-project\blah-project.csproj'.
info : Restoring packages for c:\Temp\blah-project\blah-project.csproj
info : GET https://api.nuget.org/v3-flatcontainer/mcmaster.extensions.commandlineutils/index.json
info : OK https://api.nuget.org/v3-flatcontainer/mcmaster.extensions.commandlineutils/index.json 147ms
error: Unable to load the service index for source https://myinstace.pkgs.visualstudio.com/_packaging/Blah/nuget/v3/index.json.
error: Response status code does not indicate success: 401 (Unauthorized).
The dotnet command has the option to specify --source. This allows you to only restore packages from a specific location, in this case you'd want to use
dotnet restore --source https://api.nuget.org/v3/index.json`
This should pull the packages down to your local NuGet store and solve the problem on your machine.
In order to add the package to your project you may need to manually add a <PackageReference> to your project like
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.6.0" />
Then running the restore command above will get the package for you.
As a more-permanent fix, you should put a nuget.config file in the root of the project/repository where you specify the package sources for that specific project. There are settings that you can set to override your system's global nuget configuration/sources. See more information on nuget.config. You can create a starting nuget.config in your repo with dotnet new nugetconfig
while restoring packages, dotnet make a call to all the package sources to get the package and uses the one that responds first.
In your case, because of some authentication issue it is not able to access that source. That source can be disabled using the below command and then try to pull the package.
dotnet nuget disable source <NAME> [--configfile <FILE>]
You might be able use the --ignore-failed-sources option.
I'd recently encountered similar issues when having authentication problems on a private feed, this allowed me to install the packages (was actually a tool using dotnet tool install) and address my auth issue at a later date.
See https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-restore for more info and options.

How to use iOS simulator/Android simulator from visual studio for Mac with xamarian.forms

I made mobile app at azure and quickstarted it as xamarian.forms and (after failing to publish downloaded table api application and deciding to edit it in browser) downloaded the client application they provided. Then when I tried to launch it with on (Debug>IPhone 8 Plus iOS 11.2) simulator, it (simulator) started but no application is visible (and nothing unusual is installed).
It shows warnings (could it be relevant?):
Warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. (MSB3276)
(For Android simulator it gives some error like:
/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/xbuild/Microsoft/NuGet/Microsoft.NuGet.targets(5,5): Error: Your project is not referencing the "MonoAndroid,Version=v8.0" framework. Add a reference to "MonoAndroid,Version=v8.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
)
How can I see the ****** application?
Thank you. =)
Open the project.json file in your xxx.Droid project. Change the MonoAndroid version from:
"frameworks": {
"MonoAndroid,Version=v7.1": {}
}
to:
"frameworks": {
"MonoAndroid,Version=v8.0": {}
}
Now, Restore Nuget Packages for your solution.

Can't add Google Play Services to Xamarin Android Project

I have been trying to add Xamarin Google Play Services Binding to my project so that I can add admob ads to my app.
I went and installed the Nuget package, "Xamarin Google Play Services Binding"
But then when I try to run (even if I make no other changes) I get 100+ errors about packages not existing:
For example:
Error 31 package android.support.v4.app does not exist
private native void n_onTabReselected (android.support.v7.app.ActionBar.Tab p0, android.support.v4.app.FragmentTransaction p1);
and:
Error 77 package com.google.ads.mediation does not exist
private native void n_onReceivedAd (com.google.ads.mediation.MediationInterstitialAdapter p0);
When I then go to the file I find at the top the package name is the one that claims doesn't exist, but with 'mono' attached to the front. So for example on this last error it claims that package "com.google.ads.mediation" does not exist, at the top the package itself says "package mono.com.google.ads.mediation;"
I am very new to using Xamarin and I am pulling my hair out trying to get this fixed so I would desperately appreciate any help or advice.
Try installing Google Play Services as a components instead of a Nuget Reference
http://developer.xamarin.com/guides/cross-platform/application_fundamentals/components_walkthrough/

Categories