Xamarin Native Binding - Kotlin constructor - xamarin

I am have added Native Binding for Android in Xamarin. But, Class constructor is added with one more new parameter "DefaultConstructorMarker _constructor_marker".
I have no clue to create this parameter.

Did you use the Xamarin.Kotlin.StdLib package when you created the kotlin binding library?
There was a existed similar issue on the github, according to the link, the problem has been fixed in Xamarin.Android SDK version and Visual Studio 2019 version 16.8 Preview 3, so you can try to update the xamarin.android verison in your project by upgrading the visual studio.
For more information, you can check the official document about binding a kotlin library and the issue I mentioned above.

Related

Am i using the correct version of visual studio for app development?

My current Xamrin app deveenvironment on vs2017 :
a)Xamarin.Android version v7
android references
b)Xamarin.Forms version 3.4
forms references
c)Xamrin SDK platoform 28,27 are sdk manager Tool screenshot
Reason for confusion :
a) When i googled for the documentation related Xamarin.Andorid references
#https://developer.android.com/reference/android/support/design/package-summary it showed a message that it is deprecated
b)Also my Xamarin.Forms references are not the latest as per the release info # https://learn.microsoft.com/en-us/xamarin/xamarin-forms/release-notes/
c)But my android sdk are new to latest available in vs2017
Main question :
How is the Xamarin.version and xamarin.Forms affect my app development ?Should i upgrade to the latest versions of the same ( for that i need to install vs2019)?
If you could use the latest version of them, I will suggest that do that with no doubt.
You also could refer to Xamarin.Forms release notes and roadmap to know their difference betwenn their vesions.
About the version of Visual Studio, Visual Studio 2019 will support all the features of Xamarin now, however Visual Studio 2017 will not. Also can refer to the realease notes here.

Xamarin Google API client does not exist?

I'm new to Xamarin unfortunately. I've been trying to create a simple page with a map on it using the Xamarin.Forms.Maps package, but upon building I run into about 92 errors all describing that various packages could not be found:
error: package com.google.android.gms.common.api.GoogleApiClient does not exist
error: package com.google.android.gms.common does not exist
error: package com.google.android.gms.maps.GoogleMap does not exist
error: package com.google.android.gms.maps does not exist
error: package com.google.android.gms.tasks does not exist
...and many others. My solution is a Cross-Platform Xamarin.Forms blank mobile app using a .NET class library which I have nothing but the NETStandard.Library, Xamarin.Forms and Xamarin.Forms.Maps packages installed on. I thought that I had set it up correctly according to the official Microsoft documentation, but I still get all these weird errors and searching online for a solution has not been much help. Can someone give me assistance? Let me know if I need to clarify anything.
I had exactly the same issue with the same 92 errors after upgrading my version of Xamarin.Forms to V3.0.0.561731 and installing the latest version of Xamarin.Forms.Maps in Visual Studio Community 2017.
I solved the issue by adding "Google Play Services" via the Android SDK Manager. The item can be found on the "Tools" tab of the Android SDK listed under "Extras".
Note: I had to come out of Visual Studio, and rebuild my solution, and it worked.
Make sure you have installed the nuget on your android project
Xamarin.GooglePlayServices.Base
and
Xamarin.GooglePlayServices.Maps
It's a google maps API requisite.
You can see an entire explanation on official documentation on this link: https://learn.microsoft.com/en-us/xamarin/android/platform/maps-and-location/maps/maps-api#google-maps-api-prerequisites
I had the same error.
For me the solution was to switch to the Visual Studio Preview Channel. I'm now on Version 15.8.0 Preview 2 and the error has gone away.
To get the Preview Channel you can download it here https://www.visualstudio.com/de/vs/preview/
Had this behavior but was because I only included Xamarin.Forms.Maps in PCL project. As soon as I added Xamarin.Forms.Maps also into Android (specially here) and iOS projects all compiled fine.

Data Annotation not found in .NET Standard Library in Mac Visual Studio(Community Version 2017)

I am working on a Xamarin.Forms application. Every thing was compiling and running before but then another developer who works on Visual Studio Windows version added DataAnnotation to project for validation. Since then I am getting compile time error that DataAnnotation is not found. I created a new MVC web project just to check if DataAnnotation is available for Visual Studio Community Version for MAC. It was available and is working for web projects. I have check my library versions and every thing is up to date.
Long story short; how can I add DataAnnotation for PCL projects in Visual Studio Community on Mac?
Following are the screenshots to give a better understanding of my question.
This screen shots shows that DataAnnotation is working on MAC if I create a new .NET Core MVC Project
DLL is present in .NET standard library for Windows and working just fine
But on MAC machine it gives the following errors
Use netstandard2.0 it's work. I Create a PCL Project with annotations change and change this.

Xamarin - How to update Mono.Android version to resolve dependencies?

I'm trying to install a nuget package (Xamarin.Firebase.Firestore) which requires a newer version of Xamarin.GooglePlayServices.Basement (60.1142.0, I have 42.1021.1), which in turn requires me to update the xamarin.android.support packages. When I try to update those, I get this error
"Package Xamarin.Android.Support.Design 27.0.2 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.Design 27.0.2 supports: monoandroid81 (MonoAndroid,Version=v8.1)"
I've tried changing my target android version to 8.1, I've also updated my SDK as well as the build tools. I'm running Visual Studio 15.6.1. As a last ditch effort, I tried deleting the Mono.Android V8.0 reference and then adding a new reference to V8.1, but whenever I do so, Visual studio just ends up adding the reference with the path pointing to V8.0, even though the reference I added was clearly pointing to V8.1.
Anyone has a clue how to resolve this issue?
tried changing my target android version to 8.1
You need to change the Target Framework that is used to compile your android application, not the Target Android version (but assumably you would set these two to the same, read the Understanding Android API Levels link below.
Visual Studio for Windows:
Visual Studio for Mac:
Target Framework – Specifies which framework to use in building your application. This API level is used at compile time by Xamarin.Android.
Minimum Android Version – Specifies the oldest Android version that you want your app to support. This API level is used at run time by Android.
Target Android Version – Specifies the version of Android that your app is intended to run on. This API level is used at run time by Android.
Understanding Android API Levels
Manifest Entries:
Visual Studio for Windows:
Visual Studio for Mac:

Can not compile after migrating unified api in xamarin forms

We have migrated the xamarin forms project to unified api.
But we have the strange compile error like this:
Could not AOT the assembly '.../iOS/obj/iPhone/Debug/mtouch-cache/Build/Xamarin.Forms.Labs.dll
So I changed the settings in iOS project's options.
In ios Build Tab of Project options(iOS) I changed the "don't link" to "Link all assemblies".
But the app is crashed when it is started.
xamarin version is 5.7.1(build 17).
xamarin forms's version is 1.3.5.6337.
xamarin forms labs's version is 1.0.1.5.
Please help me if you have the experience with this error.
Replace Xamarin.Forms.Labs with XLabs.Forms.
There has been a major refactoring on how the XLabs project is structured so your existing project based on the 1.x.x will break. The reason for the refactoring was simple; separate functionality that does not depend on Xamarin.Forms into different assemblies. This allows the use of functionality like IoC, Serialization and even platform specific services without referencing XF.
To upgrade:
Uninstall any existing Xamarin.Forms.Labs packages from your
project.
Install XLabs.Forms package to your projects (PCL, iOS, Droid & WP). This will update Xamarin.Forms to the latest stable release (1.4.x)
Refactor code to reference the correct namespaces.

Resources