Closed vsfeedback closed 1 year ago
If your MainActivity.cs has a line that says: Xamarin.Essentials.Platform.Init(this, savedInstanceState); then comment this line out as you don't need the Init on Essentials 1.8.0
@Doug910 where did you read this about init not being necessary?
I read it somewhere on stack overflow, but I can't find it now. I also asked Bing Chat about "Removing Xamarin.Essentials.Platform.Init" and it said:
Sure, if you’re using a version of Xamarin.Essentials that’s 1.6.0 or above, you no longer need to initialize the library in your MainActivity.cs or AppDelegate.cs files.
Here’s how you can remove it: In your MainActivity.cs (Android), you can remove this line: Xamarin.Essentials.Platform.Init(this, savedInstanceState);
It turns out both of these are wrong according to this page: https://stackoverflow.com/questions/76899724/error-cs0234-the-type-or-namespace-name-platform-does-not-exist-in-the-namesp/76899725#76899725
This says the solution is to set the Android TargetFrameworkVersion to v13.0 in csproj and AndroidManifest.xml to targetSdkVersion 33, I have both of those set but I still get Platform does not exist in Xamarin.Essentials
I don't think this is a bug on our side. Check your project against the sample that lives in this repository. Everything is working as expected, as also indicated in the Stack Overflow question you linked. Make sure you update your target framework versions as well as all dependencies on the Android side.
In regard to the Init line. I don't think you need it for all functionalities, on the other hand, there is not really a reason to not have it in there.
If you have a more concrete reason to think this is something on our side, including a reproduction sample, please let us know. Thanks!
This issue has been moved from a ticket on Developer Community.
When attempting to update Android Xamarin.Essentials to version 1.8.0, I get the errors below.
The only option to get build to work is reverting back to Android version 1.7.7
(the iOS project builds 1.8.0 without error)
MySchedule.Android/MainActivity.cs(13,13): Error CS0234: The type or namespace name 'Platform' does not exist in the namespace 'Xamarin.Essentials' (are you missing an assembly reference?) (CS0234) (MySchedule.Android)
MySchedule.Android/MainActivity.cs(13,13): Error CS0234: The type or namespace name 'Platform' does not exist in the namespace 'Xamarin.Essentials' (are you missing an assembly reference?) (CS0234) (MySchedule.Android)
MySchedule.Android/MainActivity.cs(13,13): Error CS0234: The type or namespace name 'Platform' does not exist in the namespace 'Xamarin.Essentials' (are you missing an assembly reference?) (CS0234) (MySchedule.Android)
Original Comments
Feedback Bot on 10/1/2023, 08:04 PM:
(private comment, text removed)
Original Solutions
(no solutions)