failed to resolve ObjCRuntime.TrampolineBlockBase - xamarin

I am implementing google Admob in my Xamarin.Forms application. My android project is working perfectly but my iOS project fails to build. when I build the project it shows
Failed to resolve "ObjCRuntime.TrampolineBlockBase" reference from "Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065"
and it also say I am missing few files.
I tried to download the mobile sdk framework for ios from https://developers.google.com/admob/ios/quick-start#cocoapods and then add to the project but I can't seem to add this framework to references.
Any kind of help is really helpful.

I had this issue on App Center. Resolved by upgrading SDK and Xcode versions in build configuration options

I was able to resolve the issue from upgrading the visual studio 2019 to 16.4.5 and downgrading the Xamarin.Firebase.iOS.AdMob from 7.47.0.1 to 7.27.0.3
After doing that I restarted Visual Studio and build the project it successfully built.
Also, I referred to this link for help
Edit:
In short, Visual studio installed the new appropriate mono framework for ios which basically solved the issue here.

In case anyone else runs into this issue, I got this issue after adding the Maps sdk to iOS. I had to upgrade Xamarin.iOS from 13.6.0.12 to 13.10.0.21 to resolve the issue.

Related

Found conflicts between different versions of "System.Numerics.Vectors" in Xamarin Forms 5 project

I'm building a new Xamarin Forms 5 app using VS 2022 17.1.1. Everything in the project appears to be up-to-date.
I've been working on this project for a while and never had this issue. All of a sudden it just appeared today. The last action I took was to install the Plugin.InAppBilling package, thought the package in question is not used by the Plugin.InAppBilling package.
The error is as follows:
All I can see is that the shared project is using System.Numerics.Vectors version 4.5.0 and it seems to be dependency of Xamarin.Essentials which is version 1.7.1 in my project.
However, the version number of System.Numerics.Vectors seems to be 2.0.5.0 in the Android and iOS projects.
I found the GitHub issue here but I'm not seeing any clear resolution to this issue. Even though it appears to be a warning, in my case, I can no longer run the app because I keep getting deployment error to the Android Emulator or actual device. It simply refuses to deploy my app to the device/emulator. So, it's really NOT a warning in my case. It's a show-stopper. I'm a bit surprised about how lightly the Xamarin Essentials folks seem to have taken this issue on GitHub.
Has anyone actually resolved this issue? If so, what's the solution?
BTW, in my case both the Android and the iOS projects are throwing this error/warning and both use System.Numberics.Vectors version 2.0.5.0 even though the shared project has version 4.5.0 installed as a dependency undre Xamarin Esssentials.
I'd appreciate some pointers on how to make this issue disappear. Thanks.
At first, you can try to update the Xamarin.Essentials package in the Android and IOS project with the nuget package manager to the version 1.7.1.
And then, if the error is still here, you can right click the reference and remove the reference of the System.Numberics.Vectors 2.0.5.0 both in your Android and IOS project. Then download the System.Numberics.Vectors 4.5.0 in the nuget package manager both too.

"Failed to resolve Plugin.Permissions.Abstractions.Permission" error when I try to build my cross-platform Xamarin app for an iOS phone

I'm trying to deploy a Xamarin Forms project to an iPhone, but I keep on getting the build error
Failed to resolve "Plugin.Permissions.Abstractions.Permission" reference from "Plugin.Permissions.Abstractions, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null" CyclePay.iOS
where the project's name is CyclePay. In response, I installed the latest version of Plugin.Permission (3.0.0.12) via Nuget, but I'm still having the same issue. Is the problem that the reference is coming from Plugin.Permissions version 2.2.1.0? If so, what should I do to resolve the issue?
Note that the project successfully deploys to Android, and also successfully deploys to an iOS simulator; it's just an actual phone I can't build for. I'm thinking it could also have something to do with the free provisioning profile and signing identity that I created specifically for this project, though I'm not sure what would actually be wrong in that realm. I'm programming in Visual Studio 2017, if that provides any useful information.
Any help would be appreciated!
Thanks,
Anoop Bhat
I updated the library that was depending on Plugin.Permissions (in my case it was Xam.Plugin.Geolocator) and that resolved the error for me.

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.

Rider 2018.1 iOS simulator not running after build

I have a Xamarin iOS and Android project with a dotnet standard 2.0 library that is being shared between the two operating systems. When trying to run my iOS project, the project build fine and doesn't give any errors but Rider cannot seem to deploy it to a simulator.
I will give the following error:
I thought it could be the problem what is described here, but that did not help. When running the project in VS on MacOs, the iOS project also build and runs on a simulator.
Failed to load Xamarin Forms project with .NET Standard 2.0 Lib in Rider
Can anyone help me trying to fix this, please?
You are not the only one with this problem, the problem is already reported multiple time in Riders issue tracker:
https://youtrack.jetbrains.com/issue/RIDER-15544
https://youtrack.jetbrains.com/issue/RIDER-15514
https://youtrack.jetbrains.com/issue/RIDER-15419
According to the last issue, it's fixed in Rider 2018.2, which will probably be released pretty soon.

Using EF7 SQLite on Android 7+

In my project, I am using the Microsoft.EntityFrameworkCore.SQLite package from NuGet. But for Android 7+, the app crashes with unauthorized access to "/system/lib64/libsqlite.so".
This is because Android 7 doesn't allow native libraries other than the ones in their NDK (as far as I understood). Also see this issue: https://github.com/aspnet/EntityFramework/issues/7777.
So, I researched the internet for about 2 days now and unsuccessfully tried a bunch of things to get EFCore to work on Android 7. One of them was to update to the preview version v2.0.0-preview1-final. But this resulted in other problems like the following where the app compiled, but crashed while deploying/starting on the emulator:
06-21 09:58:18.970 D/Mono ( 3632): Assembly Loader probing location: 'System.Runtime.CompilerServices.Unsafe'.
06-21 09:58:18.970 F/monodroid-assembly( 3632): Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration.
06-21 09:58:18.970 F/monodroid-assembly( 3632): This might be due to an invalid debug installation.
I then tried to add the 'System.Runtime.CompilerServices.Unsafe' NuGet package manually to my project, but it didnt fix the problem.
I messed around a lot, trying different build parameters and such and actually got the app running with the preview package of EFCore on an Android 7 emulator. However, after a project clean and rebuild, the error showed up again.
Any help on how to get EFCore Sqlite to work on Android 7?
I am using Visual Studio 2017 with Xamarin.Android 7.3.1.2
I created an example project in order to reproduce the issue: https://github.com/tipa/EFCoreSample - Basically just started with the basic Android template from VS and added the Nuget package
I know this was asked more than two months ago and you've probably found the solution, but I've wanted to post how we've managed to get around this issue.
We are developing a Xamarin.Forms application with EntityFrameworkCore and SQLite. Due to project and company policies, we are restricted to using .NetStandard 1.6 (we migrated our PCL projects from .NetFramework to .NetStandard in order to integrate EntityFrameworkCore).
After this issue started happening to us, we managed to fix this by doing the following:
Updating "Microsoft.EntityFrameworkCore" and "Microsoft.EntityFrameworkCore.SQLite" from version "1.1.1" to "2.0.0-preview1-final" (this is the latest version that works with .NetStandard 1.6) in the DAL project (we have a separate PCL project that contains the Context, UoW, Repositories and Models)
Updating just "Microsoft.Data.Sqlite" (this automatically updates the needed dependencies) from version "1.1.1" to "2.0.0-preview1-final" in the main Xamarin.Forms Android project
EntityFrameworkCore versions 2.x.x use the Android 7+ "approved" way of accessing the "libsqlite.so" file, while versions 1.x.x do not.
Hope this is of help to anyone who might use similar packages that we had.
I had the same issue and I found a solution to this problem.
I'm using Xamarin.Forms applications with .Net Standard 2.0 libs and using EFCore with SQLite. All you have to do is edit your Android csproj and add this after the last PropertyGroup tag:
<PropertyGroup>
<NoWarn>$(NoWarn);NU1605</NoWarn>
</PropertyGroup>
And then add the reference for System.Runtime.CompilerServices.Unsafe in csproj:
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.3.0" />
Clean and Rebuild your Android Project.
I found the answer to the problem here: https://developercommunity.visualstudio.com/content/problem/152947/xamarin-android-run-error-could-not-load-assembly.html

Resources