mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-11 10:18:21 +09:00
[Android] Bump target SDK version in Android manifest (#80923)
* Set target SDK version * Update Android docs * Disable tests that do not pass with target API 31 * Check if the installed Android SDK is up-to-date * Update skip explanation * Use latest SDK * Disable failing System.Net.Security test
This commit is contained in:
parent
655973db03
commit
828edfb2e4
6 changed files with 32 additions and 13 deletions
|
@ -23,9 +23,9 @@ Android SDK and NDK can be automatically installed via the following script:
|
|||
set -e
|
||||
|
||||
NDK_VER=r23c
|
||||
SDK_VER=6200805_latest
|
||||
SDK_API_LEVEL=29
|
||||
SDK_BUILD_TOOLS=29.0.3
|
||||
SDK_VER=9123335_latest
|
||||
SDK_API_LEVEL=33
|
||||
SDK_BUILD_TOOLS=33.0.1
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
HOST_OS=darwin
|
||||
|
|
|
@ -302,6 +302,7 @@ namespace System.Diagnostics.Tests
|
|||
[ActiveIssue("https://github.com/dotnet/runtime/issues/34685", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
|
||||
[InlineData(true), InlineData(false)]
|
||||
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")]
|
||||
[SkipOnPlatform(TestPlatforms.Android, "Android doesn't allow executing custom shell scripts")]
|
||||
public void ProcessStart_UseShellExecute_Executes(bool filenameAsUrl)
|
||||
{
|
||||
string filename = WriteScriptFile(TestDirectory, GetTestFileName(), returnValue: 42);
|
||||
|
@ -374,6 +375,7 @@ namespace System.Diagnostics.Tests
|
|||
nameof(PlatformDetection.IsNotAppSandbox))]
|
||||
[ActiveIssue("https://github.com/dotnet/runtime/issues/34685", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
|
||||
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")]
|
||||
[SkipOnPlatform(TestPlatforms.Android, "Android doesn't allow executing custom shell scripts")]
|
||||
public void ProcessStart_UseShellExecute_WorkingDirectory()
|
||||
{
|
||||
// Create a directory that will ProcessStartInfo.WorkingDirectory
|
||||
|
|
|
@ -96,6 +96,7 @@ namespace System.Net.Security.Tests
|
|||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
[ActiveIssue("https://github.com/dotnet/runtime/issues/70981", TestPlatforms.OSX)]
|
||||
[ActiveIssue("https://github.com/dotnet/runtime/issues/68206", TestPlatforms.Android)]
|
||||
public Task ConnectWithRevocation_WithCallback(bool checkRevocation)
|
||||
{
|
||||
X509RevocationMode mode = checkRevocation ? X509RevocationMode.Online : X509RevocationMode.NoCheck;
|
||||
|
|
|
@ -73,6 +73,8 @@ public class AndroidAppBuilderTask : Task
|
|||
|
||||
public string? MinApiLevel { get; set; }
|
||||
|
||||
public string? TargetApiLevel { get; set; }
|
||||
|
||||
public string? BuildApiLevel { get; set; }
|
||||
|
||||
public string? BuildToolsVersion { get; set; }
|
||||
|
@ -106,6 +108,7 @@ public class AndroidAppBuilderTask : Task
|
|||
apkBuilder.AndroidSdk = AndroidSdk;
|
||||
apkBuilder.AndroidNdk = AndroidNdk;
|
||||
apkBuilder.MinApiLevel = MinApiLevel;
|
||||
apkBuilder.TargetApiLevel = TargetApiLevel;
|
||||
apkBuilder.BuildApiLevel = BuildApiLevel;
|
||||
apkBuilder.BuildToolsVersion = BuildToolsVersion;
|
||||
apkBuilder.StripDebugSymbols = StripDebugSymbols;
|
||||
|
|
|
@ -13,12 +13,14 @@ using Microsoft.Build.Utilities;
|
|||
public class ApkBuilder
|
||||
{
|
||||
private const string DefaultMinApiLevel = "21";
|
||||
private const string DefaultTargetApiLevel = "31";
|
||||
|
||||
public string? ProjectName { get; set; }
|
||||
public string? AppDir { get; set; }
|
||||
public string? AndroidNdk { get; set; }
|
||||
public string? AndroidSdk { get; set; }
|
||||
public string? MinApiLevel { get; set; }
|
||||
public string? TargetApiLevel { get; set; }
|
||||
public string? BuildApiLevel { get; set; }
|
||||
public string? BuildToolsVersion { get; set; }
|
||||
public string OutputDir { get; set; } = ""!;
|
||||
|
@ -118,14 +120,24 @@ public class ApkBuilder
|
|||
if (string.IsNullOrEmpty(MinApiLevel))
|
||||
MinApiLevel = DefaultMinApiLevel;
|
||||
|
||||
// make sure BuildApiLevel >= MinApiLevel
|
||||
if (string.IsNullOrEmpty(TargetApiLevel))
|
||||
TargetApiLevel = DefaultTargetApiLevel;
|
||||
|
||||
// make sure BuildApiLevel >= MinApiLevel and BuildApiLevel >= TargetApiLevel
|
||||
// only if these api levels are not "preview" (not integers)
|
||||
if (int.TryParse(BuildApiLevel, out int intApi) &&
|
||||
int.TryParse(MinApiLevel, out int intMinApi) &&
|
||||
intApi < intMinApi)
|
||||
if (int.TryParse(BuildApiLevel, out int intApi))
|
||||
{
|
||||
throw new ArgumentException($"BuildApiLevel={BuildApiLevel} <= MinApiLevel={MinApiLevel}. " +
|
||||
"Make sure you've downloaded some recent build-tools in Android SDK");
|
||||
if (int.TryParse(MinApiLevel, out int intMinApi) && intApi < intMinApi)
|
||||
{
|
||||
throw new ArgumentException($"BuildApiLevel={BuildApiLevel} < MinApiLevel={MinApiLevel}. " +
|
||||
"Make sure you've downloaded some recent build-tools in Android SDK");
|
||||
}
|
||||
|
||||
if (int.TryParse(TargetApiLevel, out int intTargetApi) && intApi < intTargetApi)
|
||||
{
|
||||
throw new ArgumentException($"BuildApiLevel={BuildApiLevel} < TargetApiLevel={TargetApiLevel}. " +
|
||||
"Make sure you've downloaded some recent build-tools in Android SDK");
|
||||
}
|
||||
}
|
||||
|
||||
string buildToolsFolder = Path.Combine(AndroidSdk, "build-tools", BuildToolsVersion);
|
||||
|
@ -397,7 +409,8 @@ public class ApkBuilder
|
|||
File.WriteAllText(Path.Combine(OutputDir, "AndroidManifest.xml"),
|
||||
Utils.GetEmbeddedResource("AndroidManifest.xml")
|
||||
.Replace("%PackageName%", packageId)
|
||||
.Replace("%MinSdkLevel%", MinApiLevel));
|
||||
.Replace("%MinSdkLevel%", MinApiLevel)
|
||||
.Replace("%TargetSdkVersion%", TargetApiLevel));
|
||||
|
||||
string javaCompilerArgs = $"-d obj -classpath src -bootclasspath {androidJar} -source 1.8 -target 1.8 ";
|
||||
Utils.RunProcess(logger, javac, javaCompilerArgs + javaActivityPath, workingDir: OutputDir);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
package="%PackageName%"
|
||||
a:versionCode="1"
|
||||
a:versionName="1.0">
|
||||
<uses-sdk a:minSdkVersion="%MinSdkLevel%" />
|
||||
<uses-sdk a:minSdkVersion="%MinSdkLevel%" a:targetSdkVersion="%TargetSdkVersion%" />
|
||||
<uses-permission a:name="android.permission.INTERNET"/>
|
||||
<uses-permission a:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission a:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue