Unsupported PCL Profile in Xamarin - c#

I am working with the GoPro camera and trying to run a library made by r1pper. The project is described as
A lightweight c# library to access and control GoPro HERO Action cameras
It has a functional media browser based on Ambarella and GoPro App, it has also the full control of the camera, and live preview.
I am having trouble when trying to compile on the Xamarin IDE:
/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.5/Microsoft.Common.targets: Error:
Unsupported PCL Profile '.NETPortable,Version=v4.0,Profile=Profile96'. (GoPro.Hero)
I have looked at a couple of forums and blogs that mention there is no fix for this bug:
http://forums.xamarin.com/discussion/164/pcl-build-problems
http://forums.xamarin.com/discussion/6334/problem-with-pcl-support-after-update
Is there really no workaround to this bug? Or am I misunderstanding something?

It looks like Profile 96 is not available in Mono.
I would change the Portable Class Library (PCL) project so it targets a different profile that is available on Mono. I would pick Profile 78 or Profile 259 since these are the ones generally recommended by Xamarin. You can do this in the Project Options under Build - General.
You may need to reinstall/retarget the NuGet packages after changing the project's PCL profile. If you are using a recent version of Xamarin Studio then it should tell you if this is the case in the Package Console window.

If I'm not mistaken you didn't install Visual Studio 2012/2013 (which Automatically configure MSBuild for PCL usage), in this case you should install and configure PCL on your system manually (it is only needed for development, not for distribution)
Here are the steps based on this Guide
1- Install .NET Framework 4.5.1
2- Install Mono MDK
3- Install PCL Library Tools : it will install MSBuild tools and Profile96
4-(Optional) Install PCL Reference Assemblies for newer PCL profiles
after installation copy 4.6 PCL assemblies from
C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6\PortableReferenceAssemblies.zip
to
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable
5-Reinstall Xamarin Suite

Related

Nuget Hell: Cannot reference NuGet package in UWP application due to public key difference

I have a UWP app and a bunch of NETStandard 2.0 libraries. The libraries contains a lot of logic and communication interfaces that I am using in ASP.NetCore and Desktop WPF applications, so I am not going to change them.
I use NuGet packages in the libraries so I could reference those in NetCore and NetFramework projects as well. I would like to reference these packages in the UWP project - cause this is the whole point of this standardization concept isn't it?
For the UWP project this does not work. I have the latest Nuget package of System.ServiceModel.Primitives which is 4.5.3 (DLL version 4.5.0.3 - don't ask why) and PublicKeyToken is b03f5f7f11d50a3a - this can be referenced in every project except UWP.
Regardless of every attempt:
- I have installed the Nuget package for the project
- I have referenced the version explicitly in the CSPROJ file
- I have removed every other reference to SDK file version
But still, the UWP project looks for the dll in
C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.netcore.universalwindowsplatform\6.2.8\ref\uap10.0.15138\System.ServiceModel.Primitives.dll
That DLL has version of 4.2.1.1 and the PublicKeyToken is cc7b13ffcd2ddd51
Because the two tokens are different - binding redirects does not work - or maybe I am missing something. Does anyone have a workaround for this?
The whole solution is in VS2019 and I have the latest Win10 SDK installed 10.0.18362.1.
Thank you in advance.
EDIT: I forgot to mention, I have a repro on GitHub
You can create a separate .NET Standard project and incapsulate all your logic (and usage of System.ServiceModel.Primitives assembly) into this project. Then you can add it as a reference to the project with UWP executable.
Also you can setup a binding redirect for strongly-named assemblies by specifying codebase according to this article

How can I update my xamarin android project with the latest NuGet packages support libraries?

I'm using vs 2013 and xamarin version 4.7, for about 2 months I have been trying to install packages Xamarin.Android.Support.v7.RecyclerView, Xamarin.Android.Support.v7.AppCompat
and Xamarin.Android.Support.v4 and some other packages but I always receive the same error that says :
"Could not install package 'package Name'. You are trying to install
this package into a project that targets 'mono.Android,Version=v5.0',
but the package does not contain any assembly references or content
files that are compatible with that framework. For more information,
contact the package author"
I've updated my xamarin android component to the last version, research this site, other site and test install packages by other android api version but my problem does not solve.
Can anybody help me?
Sahar,
If you are not compiling your application using Android version 7.0 (API Level 24 - Nougat), you can't install the latest support libraries 24.2.1 and above. The latest contains assemblies only compatible with MonoAndroid70, hence the error message.
As I see in the error message you are compiling using Android version 5.0 (API Level 22 - Lollipop), meaning the highest version of the support libraries you can install is 23.4.0.1. That version contains assemblies compatible with MonoAndroid403.
If you are not ready to move to Nougat, it's ok not to have the latest version of the support libraries.
If you're running Visual Studio 2017 on Windows, try these two steps:
Step One:
Make sure you're running the latest version of Visual Studio 2017 or higher. Then, go to QuickSearch (Control-Q) and look for "Xamarin Android". Select "Xamarin - Android Settings".
Scroll down and check the box for "Auto Install Android SDKs".
Step Two:
In your Android project, get Properties, then open the Application tab. Next to Compile using Android version: (Target Framework), select the latest SDK.
Then, under the Android Manifest tab, select Target Android version and select Use Compile using SDK version. You can still support earlier versions of Android - just select what you want, within reason, from the Minimum Android version dropdown. Be careful here - supporting super early versions of Android is likely fraught with peril.
Once you've taken care of these steps, you should be able to install the latest Android support libraries. I imagine there are similar steps to VS Mac, but I haven't checked.
Good luck!

Xamarin Studio cross platform app error

At the moment I'm trying to launch empty app with cross-platform solution in Xamarin Studio.
I've tried make app with empty library project and shared library, both has same errors. Now unresolved problems are:
1) Build error:
Error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file classes.jar doesn't exist. (XA5207) (*projectName*)
Error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file libs/internal_impl-21.0.3.jar doesn't exist. (XA5207) (*projectName*)
This question didn't help me.
2) Some links says it could be because of old Mono.Android.Support.v4 component. My component version is 21.0.3.0. After clicking for update it says:
You are trying to install this package into a project that targets 'MonoAndroid,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework.
My Mono.Android assembly version is 0.0.0.0 and I dodn't know how to update it.
I've tried PCL project with PCL 4.5 - profile7. New projects builds normal, but after first project clean it gives me error about not found classes.jar file like described above. Another new PCL project still builds fine.
UPDATE
Error in PCL project occures not after clean - it occures with included Xamarin.Forms NuGet to Android project.
UPDATE
After rising target framework of android project to v4.0.3 I successfuly updated Mono.Android.Support.v4 component, but it still show me error about Please install package.
UPDATE
I'm using Windows 7 OS, same problem with all users including new user. But on another computer with Windows 8 it works. It is not a solution for me, but it can somehow help someone.
i think your java JDK and JRE not install properly and your path not set in your environment variable you must add your jdk path in that and if you are make application using cross platform then also add path SDK in your computer environmental variable. using CMD throw creating project.

Azure Mobile Services in a PCL project that includes WP8

Is it possible to inlcude AzureMobileServices client in a PCL that includes WP8?
I used to have a PCL project that had it up until I upgraded it to VisualStudio 2013.
The required PCL is profile78: .NET4.5, Windows Store apps (Win8), WP8, and the Xamarin twins.
I tried following this recommendation from Xamarin to reference the component's DLL directly, however the DLL was compiled for profile7 (that does not include WP8).
Yes. Make sure you are using at least version 1.1.5 of the Mobile Services NuGet package or Xamarin Component and you will be able to successfully use it from a PCL that includes WP8. For a tutorial on how to do this, see here.
It looks like their nuget package only includes directories for Store, .Net 4.5, Wp8, and Portable-Store+.Net 4.5. However if I ildasm the dll in the portable folder I see it was built for Profile78, which does support phone.
This looks like a bug with the WindowsAzure.MobileServices.nupkg nuspec authoring.

Monodevelop "Portable Library" project References are not available

Greetings,
Recently i come cross a problem while developing a cross platform project.
In this project, I have to support android, ios, and wp7, what I did is to create 3 projects for these 3 platforms, and I have another project which can be shared among the 3 target platform.
So I created this project as a "Portable Library", and add reference to this project in the other projects. It worked, I can use Class defined in this shared project in the other 3 projects, but the problem is, in the portable library project, the "References" folder, "System", "System.Core", and "System.Xml" are red, when I unfold it, it says "assembly not available for .NETPortable 4.0 Profile1 Profile (in Mono 2.10.9)". I googled this piece of information, but none gave me the satisfying answer.
http://monotouch.2284126.n4.nabble.com/cross-platform-library-code-td4656600.html
So, how can fix it? What are these "System", "System.Xml", "System.Core" for? Are they files? Or within a file?
You can ignore the references being red for now. That just indicates that you don't have the PCL assemblies on your system (which you won't have unless you are on Windows), however Xamarin is working on generating PCL assemblies and hopes to have them "soon" (by May?).
In the meantime, this is "ok" because when you are targeting Mono for Android or MonoTouch on Mac OS X w/ MonoDevelop, what MonoDevelop does is link with the Mono for Android or MonoTouch frameworks instead, which is good enough for what you want do to.
Things to consider:
You won't be able to share the assembly with your WP7 app (because the assembly built by MonoDevelop won't be a true PCL assembly), but you'll be able to share the Portable Library project - i.e. just make sure to do a fresh build of the project for each platform. (you can share between MonoTouch and Mono for Android, but not with WP7)
Since the referenced assemblies are red, as you've noticed, it means that MonoDevelop won't be able to do proper code-completion. If you're a Windows guy, you could just develop the Portable Library in Visual Studio and then just share it with your iOS and Android projects. Once Mono has real PCL assemblies, this problem will go away.
There are some bugs in the current public releases of MonoDevelop and Xamarin Studio where it doesn't like certain profiles. Both of the following custom builds address this issue, depending on whether you want MonoDevelop or the sexier Xamarin Studio:
https://files.xamarin.com/~jeff/MonoDevelop-3.1.1.dmg
https://files.xamarin.com/~jeff/XamarinStudio-4.0.2442.dmg
Keep in mind that neither of these custom builds have been QA'd. the XamarinStudio link was just sent off to the QA team last night (hot off the press!) for what will become Xamarin Studio 4.0.2 (once any regressions / critical bugs that QA turn up in that build have been fixed).

Categories