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

Target MonoAndroid13.0 #2087

Merged
merged 46 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3a9c56f
Updates for MonoAndroid13.0
jfversluis Apr 19, 2023
901a4bb
Update dependencies & obsoletes
jfversluis Apr 19, 2023
216aba9
Set Windows JDK path
jfversluis Apr 19, 2023
aaa0d15
Update azure-pipelines.yml
jfversluis Apr 19, 2023
8c206b1
Update azure-pipelines.yml
jfversluis Apr 19, 2023
b7a9054
Update azure-pipelines.yml
jfversluis Apr 19, 2023
ed158cb
Update build.cake
jfversluis Apr 19, 2023
d3f55ac
Remove devopsnuget.config
jfversluis Apr 19, 2023
8f95a21
Add Boots to DeviceTests
jfversluis Apr 19, 2023
9786fd4
Cake.Boots version upgrade
jfversluis Apr 19, 2023
9673739
async
jfversluis Apr 19, 2023
d8f910c
Update azure-pipelines.yml
jfversluis Apr 19, 2023
822c135
Update dependencies
jfversluis Apr 19, 2023
6792b99
Xcode update
jfversluis Apr 19, 2023
a840c2d
EnableMultiDex DeviceTests
jfversluis Apr 19, 2023
bb92561
Update azure-pipelines.yml
jfversluis Apr 19, 2023
a7af960
Update DeviceTests.Android.csproj
jfversluis Apr 19, 2023
dc3b08a
Update build.cake
jfversluis Apr 19, 2023
f826488
Update azure-pipelines.yml
jfversluis Apr 19, 2023
2117306
Update build.cake
jfversluis Apr 19, 2023
e8efcea
Revert "Update azure-pipelines.yml"
jfversluis Apr 20, 2023
bc6ef85
Update azure-pipelines.yml
jfversluis Apr 20, 2023
a6d8e57
Update azure-pipelines.yml
jfversluis Apr 20, 2023
1e812f7
Update azure-pipelines.yml
jfversluis Apr 20, 2023
4b32b2b
Fix Android Emulators
jfversluis Apr 20, 2023
198251a
More Android emulator fixes
jfversluis Apr 20, 2023
07aeca6
Update build.cake
jfversluis Apr 20, 2023
08a62b5
Update build.cake
jfversluis Apr 20, 2023
2a92e0c
Update build.cake
jfversluis Apr 20, 2023
088e302
Update build.cake
jfversluis Apr 20, 2023
5529fff
Update build.cake
jfversluis Apr 20, 2023
e2cc256
Update build.cake
jfversluis Apr 20, 2023
31c50da
Update azure-pipelines.yml
jfversluis Apr 20, 2023
383ec22
Update azure-pipelines.yml
jfversluis Apr 20, 2023
73a110e
Update azure-pipelines.yml
jfversluis Apr 20, 2023
7e6bf0b
Clean up cake file
jfversluis Apr 21, 2023
22a7e2f
Reenable API23 tests
jfversluis Apr 21, 2023
8054050
Revert "Reenable API23 tests"
jfversluis Apr 21, 2023
69b23ff
Reenable API30 tests
jfversluis Apr 21, 2023
9fe4a9a
Add API33 tests
jfversluis Apr 21, 2023
39cc6ef
Update azure-pipelines.yml
jfversluis Apr 21, 2023
01bdebb
Update azure-pipelines.yml
jfversluis Apr 21, 2023
ffaa63b
Update build.cake
jfversluis Apr 21, 2023
a7d3ef5
Update azure-pipelines.yml
jfversluis Apr 21, 2023
990f01b
Add AndroidManifest entry for high sampling rate
jfversluis Apr 21, 2023
5fb5402
Disable API33 tests
jfversluis Apr 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>Library</OutputType>
<RootNamespace>DeviceTests.Droid</RootNamespace>
<AssemblyName>XamarinEssentialsDeviceTestsAndroid</AssemblyName>
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v13.0</TargetFrameworkVersion>
<AndroidApplication>True</AndroidApplication>
<AndroidUseIntermediateDesignerFile>true</AndroidUseIntermediateDesignerFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
Expand All @@ -19,6 +19,7 @@
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -57,13 +58,13 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.devices" Version="2.5.25" />
<PackageReference Include="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.23212.1" />
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.0.1" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.6" />
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.3.1.1" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.15" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.1.0" package="com.xamarin.essentials.devicetests" android:installLocation="auto">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="29" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="33" />
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
Expand Down Expand Up @@ -41,5 +42,5 @@
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>
<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:theme="@style/MainTheme"></application>
<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:theme="@style/MainTheme"></application>
</manifest>
7 changes: 4 additions & 3 deletions DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.22">
<PropertyGroup>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">Xamarin.iOS10;MonoAndroid10.0;uap10.0.16299</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">Xamarin.iOS10;MonoAndroid10.0;</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">Xamarin.iOS10;MonoAndroid13.0;uap10.0.16299</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">Xamarin.iOS10;MonoAndroid13.0;</TargetFrameworks>
<AssemblyName>XamarinEssentialsDeviceTestsShared</AssemblyName>
<RootNamespace>DeviceTests.Shared</RootNamespace>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
Expand All @@ -13,6 +13,7 @@
<DefineConstants>$(DefineConstants);</DefineConstants>
<MDocDocumentationDirectory>$(MSBuildThisFileDirectory)..\docs\en</MDocDocumentationDirectory>
<Configurations>Debug;Release</Configurations>
<BuildWithMSBuildOnMono>true</BuildWithMSBuildOnMono>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
<DebugType>full</DebugType>
Expand All @@ -23,7 +24,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.devices" Version="2.5.25" />
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.9" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.devices" Version="2.5.25" />
Expand Down
2 changes: 1 addition & 1 deletion DeviceTests/DeviceTests.iOS/DeviceTests.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.devices" Version="2.5.25" />
<PackageReference Include="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.23212.1" />
Expand Down
112 changes: 101 additions & 11 deletions DeviceTests/build.cake
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#addin nuget:?package=Cake.AppleSimulator&version=0.2.0
#addin nuget:?package=Cake.Android.Adb&version=3.2.0
#addin nuget:?package=Cake.Android.AvdManager&version=2.2.0
#addin nuget:?package=Cake.Android.SdkManager&version=3.0.2
#addin nuget:?package=Cake.FileHelpers&version=3.3.0
#addin nuget:?package=Cake.Boots&version=1.1.0.712-preview2

var TARGET = Argument("target", "Default");

Expand Down Expand Up @@ -33,15 +35,24 @@ var TCP_LISTEN_HOST = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName())

var OUTPUT_PATH = MakeAbsolute((DirectoryPath)"../output/");

var ANDROID_HOME = EnvironmentVariable("ANDROID_HOME");
// set up env
var ANDROID_SDK_ROOT = GetAndroidSDKPath();
var ANDROID_HOME = ANDROID_SDK_ROOT;

System.Environment.SetEnvironmentVariable("PATH",
$"{ANDROID_HOME}/tools/bin" + System.IO.Path.PathSeparator +
$"{ANDROID_HOME}/platform-tools" + System.IO.Path.PathSeparator +
$"{ANDROID_HOME}/emulator" + System.IO.Path.PathSeparator +
EnvironmentVariable("PATH"));
SetEnvironmentVariable("PATH", $"{ANDROID_SDK_ROOT}/tools/bin", prepend: true);
SetEnvironmentVariable("PATH", $"{ANDROID_SDK_ROOT}/cmdline-tools/5.0/bin", prepend: true);
SetEnvironmentVariable("PATH", $"{ANDROID_SDK_ROOT}/cmdline-tools/7.0/bin", prepend: true);
SetEnvironmentVariable("PATH", $"{ANDROID_SDK_ROOT}/cmdline-tools/latest/bin", prepend: true);

var RESTORE_CONFIG = MakeAbsolute((FilePath)"../devopsnuget.config").FullPath;
SetEnvironmentVariable("PATH", $"{ANDROID_SDK_ROOT}/platform-tools", prepend: true);
SetEnvironmentVariable("PATH", $"{ANDROID_SDK_ROOT}/emulator", prepend: true);

Information("Android SDK Root: {0}", ANDROID_SDK_ROOT);

string androidSdks = EnvironmentVariable("ANDROID_API_SDKS", "platform-tools,platforms;android-26,platforms;android-27,platforms;android-28,platforms;android-29,build-tools;29.0.3,platforms;android-30,build-tools;30.0.2,platforms;android-32,build-tools;32.0.0,platforms;android-33,build-tools;33.0.2");

Information("ANDROID_API_SDKS: {0}", androidSdks);
string[] androidSdkManagerInstalls = androidSdks.Split(',');

// utils

Expand Down Expand Up @@ -88,6 +99,28 @@ Task DownloadTcpTextAsync(int port, FilePath filename, Action waitAction = null)
});
}

void SetEnvironmentVariable(string name, string value, bool prepend = false)
{
var target = EnvironmentVariableTarget.Process;

if (prepend)
value = value + System.IO.Path.PathSeparator + EnvironmentVariable(name);

Environment.SetEnvironmentVariable(name, value, target);

Information("Setting environment variable: {0} = '{1}'", name, value);
}

string GetAndroidSDKPath()
{
var ANDROID_SDK_ROOT = Argument("android", EnvironmentVariable("ANDROID_SDK_ROOT") ?? EnvironmentVariable("ANDROID_HOME"));

if (string.IsNullOrEmpty(ANDROID_SDK_ROOT)) {
throw new Exception("Environment variable 'ANDROID_SDK_ROOT' or 'ANDROID_HOME' must be set to the Android SDK root.");
}

return ANDROID_SDK_ROOT;
}

// iOS tasks

Expand All @@ -100,7 +133,6 @@ Task("build-ios")
c.Properties["Platform"] = new List<string> { "iPhoneSimulator" };
c.Properties["BuildIpa"] = new List<string> { "true" };
c.Properties["ContinuousIntegrationBuild"] = new List<string> { "false" };
c.Properties["RestoreConfigFile"] = new List<string> { RESTORE_CONFIG };
c.Targets.Clear();
c.Targets.Add("Rebuild");
c.BinaryLogger = new MSBuildBinaryLogSettings {
Expand Down Expand Up @@ -138,14 +170,71 @@ Task("test-ios-emu")

// Android tasks

Task("boots")
.Does(async () =>
{
await Boots (Product.XamarinAndroid, ReleaseChannel.Stable);
});

Task("provision-androidsdk")
.Description("Install Xamarin.Android SDK")
.Does(() =>
{
Information ("ANDROID_HOME: {0}", ANDROID_HOME);

if(androidSdkManagerInstalls.Length > 0)
{
Information("Updating Android SDKs");
var androidSdkSettings = new AndroidSdkManagerToolSettings {
SkipVersionCheck = true
};

if(!String.IsNullOrWhiteSpace(ANDROID_HOME))
androidSdkSettings.SdkRoot = ANDROID_HOME;

try{
AcceptLicenses (androidSdkSettings);
}
catch(Exception exc)
{
Information("AcceptLicenses: {0}", exc);
}

try{
AndroidSdkManagerUpdateAll (androidSdkSettings);
}
catch(Exception exc)
{
Information("AndroidSdkManagerUpdateAll: {0}", exc);
}

try{
AcceptLicenses (androidSdkSettings);
}
catch(Exception exc)
{
Information("AcceptLicenses: {0}", exc);
}

try{
AndroidSdkManagerInstall (androidSdkManagerInstalls, androidSdkSettings);
}
catch(Exception exc)
{
Information("AndroidSdkManagerInstall: {0}", exc);
}
}
});

Task("build-android")
.IsDependentOn("provision-androidsdk")
.IsDependentOn("boots")
.Does(() =>
{
MSBuild(ANDROID_PROJ, c => {
c.Configuration = "Debug"; // needs to be debug so unit tests get discovered
c.Restore = true;
c.Properties["ContinuousIntegrationBuild"] = new List<string> { "false" };
c.Properties["RestoreConfigFile"] = new List<string> { RESTORE_CONFIG };
c.Targets.Clear();
c.Targets.Add("Rebuild");
c.Targets.Add("SignAndroidPackage");
Expand Down Expand Up @@ -188,12 +277,14 @@ Task("test-android-emu")
}
Information("Waited {0} seconds for the emulator to boot up.", waited);

var targetArch = ANDROID_EMU_TARGET.Split(';').Last();

// Run the tests
var resultCode = StartProcess("xharness", "android test " +
$"--app=\"{ANDROID_APK_PATH}\" " +
$"--package-name=\"{ANDROID_PKG_NAME}\" " +
$"--instrumentation=\"{ANDROID_INSTRUMENTATION_NAME}\" " +
$"--device-arch=\"x86\" " +
$"--device-arch=\"{targetArch}\" " +
$"--output-directory=\"{ANDROID_TEST_RESULTS_PATH}\" " +
$"--verbosity=\"Debug\" ");

Expand Down Expand Up @@ -225,7 +316,6 @@ Task("build-uwp")
c.Properties["AppxBundlePlatforms"] = new List<string> { "x86" };
c.Properties["AppxBundle"] = new List<string> { "Always" };
c.Properties["AppxPackageSigningEnabled"] = new List<string> { "true" };
c.Properties["RestoreConfigFile"] = new List<string> { RESTORE_CONFIG };
c.Targets.Clear();
c.Targets.Add("Rebuild");
c.BinaryLogger = new MSBuildBinaryLogSettings {
Expand Down
6 changes: 3 additions & 3 deletions Samples/Samples.Android/Samples.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v13.0</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
Expand Down Expand Up @@ -58,8 +58,8 @@
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="4.5.3" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2578" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Samples/Samples.Mac/Samples.Mac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="4.5.3" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2578" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Samples/Samples.UWP/Samples.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="4.5.3" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2578" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.9" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Samples/Samples.iOS/Samples.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="4.5.3" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2578" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Samples/Samples/Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.5.3" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="4.5.3" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2083" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="5.0.0.2578" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>

Expand Down
4 changes: 4 additions & 0 deletions Xamarin.Essentials/AppInfo/AppInfo.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ static string PlatformGetVersionString()
{
var pm = Platform.AppContext.PackageManager;
var packageName = Platform.AppContext.PackageName;
#pragma warning disable CS0618 // Type or member is obsolete
using (var info = pm.GetPackageInfo(packageName, PackageInfoFlags.MetaData))
#pragma warning restore CS0618 // Type or member is obsolete
{
return info.VersionName;
}
Expand All @@ -36,7 +38,9 @@ static string PlatformGetBuild()
{
var pm = Platform.AppContext.PackageManager;
var packageName = Platform.AppContext.PackageName;
#pragma warning disable CS0618 // Type or member is obsolete
using (var info = pm.GetPackageInfo(packageName, PackageInfoFlags.MetaData))
#pragma warning restore CS0618 // Type or member is obsolete
{
#if __ANDROID_28__
return PackageInfoCompat.GetLongVersionCode(info).ToString(CultureInfo.InvariantCulture);
Expand Down
4 changes: 3 additions & 1 deletion Xamarin.Essentials/Connectivity/Connectivity.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ static NetworkAccess PlatformNetworkAccess

if (Platform.HasApiLevel(BuildVersionCodes.Lollipop))
{
#pragma warning disable CS0618 // Type or member is obsolete
var networks = manager.GetAllNetworks();
#pragma warning restore CS0618 // Type or member is obsolete

// some devices running 21 and 22 only use the older api.
if (networks.Length == 0 && (int)Build.VERSION.SdkInt < 23)
Expand Down Expand Up @@ -212,9 +214,9 @@ static IEnumerable<ConnectionProfile> PlatformConnectionProfiles
var manager = Platform.ConnectivityManager;
if (Platform.HasApiLevel(BuildVersionCodes.Lollipop))
{
#pragma warning disable CS0618 // Type or member is obsolete
foreach (var network in manager.GetAllNetworks())
{
#pragma warning disable CS0618 // Type or member is obsolete
NetworkInfo info = null;
try
{
Expand Down
2 changes: 2 additions & 0 deletions Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ static DisplayInfo GetMainDisplayInfo()
{
using var displayMetrics = new DisplayMetrics();
var display = GetDefaultDisplay();
#pragma warning disable CS0618 // Type or member is obsolete
display?.GetRealMetrics(displayMetrics);
#pragma warning restore CS0618 // Type or member is obsolete

return new DisplayInfo(
width: displayMetrics?.WidthPixels ?? 0,
Expand Down
Loading