Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

[Bug] [Android] [Regression] 1.8.0 Android assembly doesn't appear to contain Xamarin.Essentials.Platform #2097

Closed
mfeingol opened this issue Aug 14, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@mfeingol
Copy link

Description

Steps to Reproduce

  1. Upgrade Xamarin Forms app using Xamarin Essentials 1.7.7 to 1.8.0
  2. Build Android project
  3. Observer build errors

Expected Behavior

No API changes

Actual Behavior

1>C:\Operations\Build\Home\Sideroads\Source\Sideroads.Xamarin\Sideroads.Android\MainActivity.cs(138,13,138,40): error CS0234: The type or namespace name 'Platform' does not exist in the namespace 'Xamarin.Essentials' (are you missing an assembly reference?)
1>C:\Operations\Build\Home\Sideroads\Source\Sideroads.Xamarin\Sideroads.Android\MainActivity.cs(190,13,190,40): error CS0234: The type or namespace name 'Platform' does not exist in the namespace 'Xamarin.Essentials' (are you missing an assembly reference?)

The lines in question are

Xamarin.Essentials.Platform.Init(this, bundle);

and

Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);

Basic Information

  • Version with issue: 1.8.0
  • Last known good version: 1.7.7
  • IDE: VS 2022 latest stable
  • Platform Target Frameworks:
    • Android: 13
@mfeingol mfeingol added the bug Something isn't working label Aug 14, 2023
@jfversluis
Copy link
Member

jfversluis commented Aug 14, 2023

I see you mention that you're targeting Android 13 but can you double-check? I've had other reports and they let me know that targeting Android 13 fixed it for them.

Xamarin.Essentials 1.8 now has MonoAndroid13 as the target framework, your project should do the same :) that means you should also target API 33. See detailed instructions in this blog post.

After you have updated the target framework you might want to do some aggressive cleaning and rebuilding and maybe even delete your bin/obj folders to make sure nothing is left behind building against MonoAndroid10

@mfeingol
Copy link
Author

That was it, thanks. UI showed using SDK version 13 (which I think is read/written from the manifest), but TargetFrameworkVersion in csproj was still set to 12.

@jfversluis
Copy link
Member

Thanks for letting me know! I did update the GitHub releases here to make this a little more clearer as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants