[Mono.Android] Android API-O Preview support (#514)

First step towards support for Android-O Preview API.

The changes are big due to the structural changes in Android SDK,
particularly that "android" command line tool is gone and they had to
be rewritten. Samples that depended on "create" or "update" command
had to be checked in as already-created state so that they don't have
to bring further dependencies.

Changes in the library (Mono.Android) itself is not very big at all.

`src/Mono.Android/Profiles/api-O.xml.in` comes from API-O DP 1's
`android.jar`.
This commit is contained in:
Atsushi Eno 2017-04-26 05:06:32 +09:00 коммит произвёл Jonathan Pryor
Родитель ffa41aa9cb
Коммит 571546a1a6
54 изменённых файлов: 230068 добавлений и 118 удалений

Просмотреть файл

@ -36,6 +36,7 @@
<MonoSgenBridgeVersion Condition=" '$(MonoSgenBridgeVersion)' == '' ">5</MonoSgenBridgeVersion>
<HOME Condition=" '$(HOME)' == '' ">$(HOMEDRIVE)$(HOMEPATH)</HOME>
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">25</AndroidApiLevel>
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidApiLevel)</AndroidPlatformId>
<AndroidPreviousFrameworkVersion Condition=" '$(AndroidPreviousFrameworkVersion)' == '' ">v1.0</AndroidPreviousFrameworkVersion>
<AndroidFrameworkVersion Condition=" '$(AndroidFrameworkVersion)' == '' ">$(AndroidLatestFrameworkVersion)</AndroidFrameworkVersion>
<AndroidToolchainCacheDirectory Condition=" '$(AndroidToolchainCacheDirectory)' == '' ">$(HOME)\android-archives</AndroidToolchainCacheDirectory>
@ -61,7 +62,8 @@
<AllSupported32BitTargetAndroidAbis>armeabi;armeabi-v7a;x86</AllSupported32BitTargetAndroidAbis>
<AllSupported64BitTargetAndroidAbis>arm64-v8a;x86_64</AllSupported64BitTargetAndroidAbis>
<AllSupportedTargetAndroidAbis>$(AllSupported32BitTargetAndroidAbis);$(AllSupported64BitTargetAndroidAbis)</AllSupportedTargetAndroidAbis>
<XABuildToolsVersion>25.0.1</XABuildToolsVersion>
<XABuildToolsVersion>26-rc1</XABuildToolsVersion>
<XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">26.0.0-rc1</XABuildToolsFolder>
</PropertyGroup>
<PropertyGroup>
<_MingwPrefixTail Condition=" '$(HostOS)' == 'Darwin' ">.static</_MingwPrefixTail>
@ -85,7 +87,9 @@
<PropertyGroup>
<AdbToolPath Condition=" '$(AdbToolPath)' == '' ">$(AndroidSdkFullPath)\platform-tools</AdbToolPath>
<AdbToolExe Condition=" '$(AdbToolExe)' == '' ">adb</AdbToolExe>
<AvdManagerToolExe Condition=" '$(AvdManagerToolExe)' == '' ">avdmanager</AvdManagerToolExe>
<AndroidToolPath Condition=" '$(AndroidToolPath)' == '' ">$(AndroidSdkFullPath)\tools</AndroidToolPath>
<AndroidToolsBinPath Condition=" '$(AndroidToolsBinPath)' == '' ">$(AndroidToolPath)\bin</AndroidToolsBinPath>
<AndroidToolExe Condition=" '$(AndroidToolExe)' == '' ">android</AndroidToolExe>
<EmulatorToolPath Condition=" '$(EmulatorToolPath)' == '' ">$(AndroidSdkFullPath)\tools</EmulatorToolPath>
<EmulatorToolExe Condition=" '$(EmulatorToolExe)' == '' ">emulator</EmulatorToolExe>

Просмотреть файл

@ -22,6 +22,7 @@
_UnzipFiles;
_CreateNdkToolchains;
_CreateMxeToolchains;
_AcceptAndroidSdkLicenses;
</BuildDependsOn>
</PropertyGroup>
<ItemGroup>
@ -44,4 +45,4 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
</Project>

Просмотреть файл

@ -13,31 +13,39 @@
-->
<AndroidSdkItem Include="build-tools_r$(XABuildToolsVersion)-linux.zip">
<HostOS>Linux</HostOS>
<DestDir>build-tools\$(XABuildToolsVersion)</DestDir>
<DestDir>build-tools\$(XABuildToolsFolder)</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="platform-tools_r23-linux.zip">
<AndroidSdkItem Include="platform-tools_r26.0.0-rc1-linux.zip">
<HostOS>Linux</HostOS>
<DestDir>platform-tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="tools_r24.4.1-linux.zip">
<AndroidSdkItem Include="sdk-tools-linux-3859397.zip">
<HostOS>Linux</HostOS>
<DestDir>tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="emulator-linux-3887480.zip">
<HostOS>Linux</HostOS>
<DestDir>emulator</DestDir>
</AndroidSdkItem>
<AndroidNdkItem Include="android-ndk-r11c-darwin-x86_64.zip">
<HostOS>Darwin</HostOS>
</AndroidNdkItem>
<AndroidSdkItem Include="build-tools_r$(XABuildToolsVersion)-macosx.zip">
<HostOS>Darwin</HostOS>
<DestDir>build-tools\$(XABuildToolsVersion)</DestDir>
<DestDir>build-tools\$(XABuildToolsFolder)</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="platform-tools_r23-macosx.zip">
<AndroidSdkItem Include="platform-tools_r26.0.0-rc1-darwin.zip">
<HostOS>Darwin</HostOS>
<DestDir>platform-tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="tools_r24.4.1-macosx.zip">
<AndroidSdkItem Include="sdk-tools-darwin-3859397.zip">
<HostOS>Darwin</HostOS>
<DestDir>tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="emulator-darwin-3887480.zip">
<HostOS>Darwin</HostOS>
<DestDir>emulator</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="android-2.3.3_r02-linux.zip">
<HostOS></HostOS>
<DestDir>platforms\android-10</DestDir>
@ -86,18 +94,22 @@
<HostOS></HostOS>
<DestDir>platforms\android-25</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="android_m2repository_r16.zip">
<AndroidSdkItem Include="platform-O_r01.zip">
<HostOS></HostOS>
<DestDir>extras\android\m2repository</DestDir>
<DestDir>platforms\android-O</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="docs-24_r01.zip">
<HostOS></HostOS>
<DestDir>docs</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="sysimg_x86-21_r03.zip">
<AndroidSdkItem Include="android_m2repository_r16.zip">
<HostOS></HostOS>
<DestDir>extras\android\m2repository</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="x86-21_r04.zip">
<HostOS></HostOS>
<RelUrl>sys-img/android/</RelUrl>
<DestDir>system-images\android-21\x86</DestDir>
<DestDir>system-images\android-21\default\x86</DestDir>
</AndroidSdkItem>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -3,6 +3,7 @@
<Import Project="..\..\Configuration.props" />
<Import Project="android-toolchain.projitems" />
<Import Project="..\scripts\RequiredPrograms.targets" />
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.AcceptAndroidSdkLicenses" />
<Target Name="_CopyBootstrapTasksAssembly"
Outputs="$(OutputPath)\Xamarin.Android.Tools.BootstrapTasks.dll">
<MSBuild
@ -123,6 +124,9 @@
<_AndroidMxeOutput Include="@(_AndroidMxeToolchain->'$(AndroidMxeFullPath)\%(Identity)\include\zlib.h')" />
<_AndroidMxeOutput Include="@(_AndroidMxeToolchain->'$(AndroidMxeFullPath)\%(Identity)\lib\libz.a')" />
</ItemGroup>
<Target Name="_AcceptAndroidSdkLicenses">
<AcceptAndroidSdkLicenses AndroidSdkDirectory="$(AndroidSdkDirectory)" />
</Target>
<Target Name="_CreateMxeToolchains"
DependsOnTargets="_SetMxeToolchainMakefileTimeToLastCommitTimestamp"
Condition=" '$(NeedMxe)' == 'true' And ($(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win32:')) Or $(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win64:')))"

Просмотреть файл

@ -14,7 +14,7 @@ API_XML_TOOL = $(BUILDBIN)/api-xml-adjuster.exe
RUNTIME = mono
RUN_CLASS_PARSE = $(RUNTIME) $(CLASS_PARSE)
RUN_API_XML_TOOL = $(RUNTIME) $(API_XML_TOOL)
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 O
XML_OUTPUT_DIR = .
@ -81,6 +81,9 @@ docs-%.zip:
docs-25_web.zip:
curl -L https://dl.dropboxusercontent.com/u/493047/2016/docs-25-web.zip > $@ || exit 1
docs-O_web.zip:
curl -L https://www.dropbox.com/s/3xr11fpd08xpolg/docs-O-web.zip?dl=0 > $@ || exit 1
# API level 10 is Android v2.3.3; it's API level 9 (Android v2.3) with a few
# bugfixes which don't impact the documentation.
$(DOCS_DIR)/docs-api-10: docs-2.3_r01-linux.zip
@ -119,3 +122,7 @@ $(DOCS_DIR)/docs-api-24: docs-24_r01.zip
$(DOCS_DIR)/docs-api-25: docs-25_web.zip # Google hadn't published docs component yet!
$(call extract-docs,$<,docs)
docs-api-O: docs-O_web.zip # No preview docs yet
$(call extract-docs,$<,docs)

Просмотреть файл

@ -15,12 +15,12 @@ ZIP_OUTPUT = $(ZIP_OUTPUT_BASENAME).zip
# $(ALL_API_LEVELS) and $(ALL_FRAMEWORKS) must be kept in sync w/ each other
ALL_API_LEVELS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# this was different when API Level 21 was "L". Same could happen in the future.
ALL_PLATFORM_IDS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
ALL_API_LEVELS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
# this was different from ALL_API_LEVELS when API Level 26 was "O". Same could happen in the future.
ALL_PLATFORM_IDS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 O
# supported api levels
ALL_FRAMEWORKS = _ _ _ _ _ _ _ _ _ v2.3 _ _ _ _ v4.0.3 v4.1 v4.2 v4.3 v4.4 v4.4.87 v5.0 v5.1 v6.0 v7.0 v7.1
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25
ALL_FRAMEWORKS = _ _ _ _ _ _ _ _ _ v2.3 _ _ _ _ v4.0.3 v4.1 v4.2 v4.3 v4.4 v4.4.87 v5.0 v5.1 v6.0 v7.0 v7.1 v7.99.0
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26
STABLE_API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24
FRAMEWORKS = $(foreach a, $(API_LEVELS), $(word $(a),$(ALL_FRAMEWORKS)))
@ -92,17 +92,16 @@ task-assemblies:
framework-assemblies:
PREV_VERSION="v1.0"; \
for a in $(API_LEVELS); do \
CUR_VERSION=`echo "$(ALL_FRAMEWORKS)"|tr -s " "|cut -d " " -s -f $${a}`; \
$(foreach a, $(API_LEVELS), \
CUR_VERSION=`echo "$(ALL_FRAMEWORKS)"|tr -s " "|cut -d " " -s -f $(a)`; \
$(foreach conf, $(CONFIGURATIONS), \
REDIST_FILE=bin/$(conf)/lib/xbuild-frameworks/MonoAndroid/$${CUR_VERSION}/RedistList/FrameworkList.xml; \
grep -q $${PREV_VERSION} $${REDIST_FILE}; \
if [ $$? -ne 0 ] ; then \
rm -f bin/$(conf)/lib/xbuild-frameworks/MonoAndroid/$${CUR_VERSION}/RedistList/FrameworkList.xml; \
fi; \
$(MSBUILD) $(MSBUILD_FLAGS) src/Mono.Android/Mono.Android.csproj /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$${a} /p:AndroidFrameworkVersion=$${CUR_VERSION} /p:AndroidPreviousFrameworkVersion=$${PREV_VERSION}; ) \
PREV_VERSION=$${CUR_VERSION}; \
done
$(MSBUILD) $(MSBUILD_FLAGS) src/Mono.Android/Mono.Android.csproj /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$(a) /p:AndroidPlatformId=$(word $(a), $(ALL_PLATFORM_IDS)) /p:AndroidFrameworkVersion=$${CUR_VERSION} /p:AndroidPreviousFrameworkVersion=$${PREV_VERSION}; ) \
PREV_VERSION=$${CUR_VERSION}; ) \
$(foreach conf, $(CONFIGURATIONS), \
rm -f bin/$(conf)/lib/xbuild-frameworks/MonoAndroid/v1.0/Xamarin.Android.NUnitLite.dll; \
$(MSBUILD) $(MSBUILD_FLAGS) src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$(firstword $(API_LEVELS)) /p:AndroidFrameworkVersion=$(firstword $(FRAMEWORKS)); )
@ -115,7 +114,7 @@ opentk-jcw:
$(foreach a, $(API_LEVELS), \
$(foreach conf, $(CONFIGURATIONS), \
touch bin/$(conf)/lib/xbuild-frameworks/MonoAndroid/*/OpenTK-1.0.dll; \
$(MSBUILD) $(MSBUILD_FLAGS) src/OpenTK-1.0/OpenTK.csproj /t:GenerateJavaCallableWrappers /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$(a) /p:AndroidFrameworkVersion=$(word $(a), $(ALL_FRAMEWORKS)); ))
$(MSBUILD) $(MSBUILD_FLAGS) src/OpenTK-1.0/OpenTK.csproj /t:GenerateJavaCallableWrappers /p:Configuration=$(conf) $(_MSBUILD_ARGS) /p:AndroidApiLevel=$(a) /p:AndroidPlatformId=$(word $(a), $(ALL_PLATFORM_IDS)) /p:AndroidFrameworkVersion=$(word $(a), $(ALL_FRAMEWORKS)); ))
_BUNDLE_ZIPS_INCLUDE = \
$(ZIP_OUTPUT_BASENAME)/bin/Debug \

Просмотреть файл

@ -25,7 +25,7 @@
<PropertyGroup>
<_Target>-source $(JavacSourceVersion) -target $(JavacSourceVersion)</_Target>
<_D>-d "$(IntermediateOutputPath)jcw\bin"</_D>
<_AndroidJar>"$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidApiLevel)\android.jar"</_AndroidJar>
<_AndroidJar>"$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidPlatformId)\android.jar"</_AndroidJar>
<_MonoAndroidJar>$(OutputPath)mono.android.jar</_MonoAndroidJar>
</PropertyGroup>
<Exec

Просмотреть файл

@ -26,8 +26,8 @@
AndroidSdkHome="$(AndroidSdkDirectory)"
SdkVersion="21"
ImageName="$(_TestImageName)"
ToolExe="$(AndroidToolExe)"
ToolPath="$(AndroidToolPath)"
ToolExe="$(AvdManagerToolExe)"
ToolPath="$(AndroidToolsBinPath)"
/>
<StartAndroidEmulator
Condition=" '$(_ValidAdbTarget)' != 'True' "

Просмотреть файл

@ -0,0 +1,28 @@
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Xamarin.Android.BuildTools.PrepTasks
{
public class AcceptAndroidSdkLicenses : Task
{
[Required]
public string AndroidSdkDirectory { get; set; }
public override bool Execute ()
{
var licdir = Path.Combine (Path.Combine (AndroidSdkDirectory, "licenses"));
Directory.CreateDirectory (licdir);
var psi = new ProcessStartInfo (Path.Combine (AndroidSdkDirectory, "tools", "bin", "sdkmanager"), "--licenses") { UseShellExecute = false, RedirectStandardInput = true };
var proc = Process.Start (psi);
for (int i = 0; i < 10; i++)
proc.StandardInput.WriteLine ('y');
proc.WaitForExit ();
return true;
}
}
}

Просмотреть файл

@ -48,6 +48,7 @@
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\GitCommitsInRange.cs" />
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\ReplaceFileContents.cs" />
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\PrepareInstall.cs" />
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\AcceptAndroidSdkLicenses.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="xa-prep-tasks.targets" />

Просмотреть файл

@ -107,31 +107,10 @@
</ItemGroup>
<Target Name="_GenerateMonoAndroidDex16"
AfterTargets="GenerateJavaCallableWrappers"
Condition="'$(JavacSourceVersion)' == '1.6'"
Inputs="$(OutputPath)mono.android.jar"
Outputs="$(OutputPath)mono.android.dex">
<Exec
Command="&quot;$(AndroidSdkDirectory)&quot;\build-tools\$(XABuildToolsVersion)\dx --dex --output=&quot;$(OutputPath)mono.android.dex&quot; &quot;$(OutputPath)mono.android.jar&quot;"
/>
</Target>
<Target Name="_GenerateMonoAndroidDex18"
AfterTargets="GenerateJavaCallableWrappers"
Condition="'$(JavacSourceVersion)' == '1.8'"
Inputs="$(OutputPath)mono.android.jar"
Outputs="$(OutputPath)mono.android.dex">
<MakeDir
Directories="$(IntermediateOutputPath)__dex"
/>
<Exec
Command="java -jar &quot;$(AndroidSdkDirectory)&quot;\build-tools\$(XABuildToolsVersion)\jack.jar --output-dex=&quot;$(IntermediateOutputPath)__dex&quot; -cp &quot;$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidApiLevel)\android.jar&quot; @&quot;$(IntermediateOutputPath)jcw\classes.txt&quot;"
/>
<Copy
SourceFiles="$(IntermediateOutputPath)__dex\classes.dex"
DestinationFiles="$(OutputPath)mono.android.dex"
/>
<Touch Files="$(OutputPath)mono.android.dex" />
<RemoveDir
Directories="$(IntermediateOutputPath)__dex"
Command="&quot;$(AndroidSdkDirectory)\build-tools\$(XABuildToolsFolder)\dx&quot; --dex --no-strict --output=&quot;$(OutputPath)mono.android.dex&quot; &quot;$(OutputPath)mono.android.jar&quot;"
/>
</Target>
<Target Name="_GenerateFrameworkList"

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1128,7 +1128,7 @@
<!-- name conflict resolution -->
<attr path="/api/package[@name='android.net.wifi']/class[@name='WifiConfiguration']/field[@name='status']" name="managedName">StatusField</attr>
<!-- Android M -->
<!-- Android M (API Level 23) -->
<!-- FIXME: there is another M-preview specific build error:
@ -1141,7 +1141,7 @@
<attr path="/api/package[@name='android.app']/class[@name='Notification']/method[@name='getLargeIcon']" name="propertyName"></attr>
<!-- Android N Preview -->
<!-- Android N (API Level 24-25) -->
<attr path="/api/package[@name='java.util.function']" name="managedName">Java.Util.Functions</attr>
<attr path="/api/package[@name='java.util.stream']" name="managedName">Java.Util.Streams</attr>
@ -1319,4 +1319,39 @@
<attr path="/api/package[@name='java.util.concurrent.atomic']/class[@name='AtomicLong']/method[@name='getAndDecrement']" name="propertyName"></attr>
<attr path="/api/package[@name='java.util.concurrent.atomic']/class[@name='AtomicLong']/method[@name='getAndIncrement']" name="propertyName"></attr>
<!-- Android O (API Level 26) -->
<attr path="/api/package[@name='android.view.autofill']" name="managedName">Android.Views.AutoFill</attr>
<attr path="/api/package[@name='android.view.textclassifier']" name="managedName">Android.Views.TextClassifiers</attr>
<attr path="/api/package[@name='java.nio.file']" name="managedName">Java.Nio.FileNio</attr>
<attr path="/api/package[@name='java.nio.file.attribute']" name="managedName">Java.Nio.FileNio.Attributes</attr>
<attr path="/api/package[@name='java.nio.file.spi']" name="managedName">Java.Nio.FileNio.Spi</attr>
<!-- FIXME: fix build and enable these packages -->
<remove-node path="/api/package[@name='java.time']" api-since="26" />
<remove-node path="/api/package[@name='java.time.chrono']" api-since="26" />
<!-- FIXME: fix build and enable these types -->
<remove-node path="/api/package[@name='java.nio.channels']/class[@name='AsynchronousFileChannel']" api-since="26" />
<remove-node path="/api/package[@name='java.nio.channels']/class[@name='AsynchronousSocketChannel']" api-since="26" />
<remove-node path="/api/package[@name='java.nio.channels']/class[@name='AsynchronousServerSocketChannel']" api-since="26" />
<!-- FIXME: fix build and enable this method -->
<remove-node path="/api/package[@name='android.text']/class[@name='TextUtils']/method[@name='listEllipsize']" api-since="26" />
<!-- interface default method -->
<remove-node path="/api/package[@name='java.lang.reflect']/interface[@name='AnnotatedElement']/method[@name='isAnnotationPresent']" api-since="26" />
<!-- This is possibly a new kind of problem that a class can have a pair of
methods where one returns a CharSequence and the other returns java.lang.String.
Such a pair will result in build error as both result in System.String
overloads (therefore duplicates in C# land).
We remove one with java.lang.String; with a System.String overload it should be fine for most of managed developers. -->
<remove-node path="/api/package[@name='android.text']/class[@name='BidiFormatter']/method[@name='unicodeWrap' and @return='java.lang.String']" api-since="26" />
<!-- interfaces that implement BasicFileAttributeView often have return value of a derived type. So change the managed return type. -->
<attr path="/api/package[@name='java.nio.file.attribute']/*[implements[@name='java.nio.file.attribute.BasicFileAttributeView']]/method[@name='readAttributes']" name="managedReturn">Java.Nio.FileNio.Attributes.IBasicFileAttributes</attr>
</metadata>

Просмотреть файл

@ -435,6 +435,8 @@ namespace Xamarin.Android.Tasks
public static string GetPlatformApiLevelName (string platformApiLevel)
{
switch (platformApiLevel.Trim ()) {
case "26":
return "O";
default:
return platformApiLevel;
}
@ -445,6 +447,8 @@ namespace Xamarin.Android.Tasks
public static string GetPlatformApiLevel (string platformApiLevelName)
{
switch (platformApiLevelName.Trim ()) {
case "O":
return "26";
default:
return platformApiLevelName;
}

Просмотреть файл

@ -26,7 +26,7 @@ namespace Xamarin.Android.Tools.BootstrapTasks
public override bool Execute ()
{
if (string.IsNullOrEmpty (TargetId) && !string.IsNullOrEmpty (SdkVersion)) {
TargetId = "android-" + SdkVersion;
TargetId = "system-images;android-" + SdkVersion + ";default;" + AndroidAbi;
}
Log.LogMessage (MessageImportance.Low, $"Task {nameof (CreateAndroidEmulator)}");
Log.LogMessage (MessageImportance.Low, $" {nameof (AndroidAbi)}: {AndroidAbi}");
@ -45,7 +45,7 @@ namespace Xamarin.Android.Tools.BootstrapTasks
string GetAndroidPath ()
{
if (string.IsNullOrEmpty (ToolExe))
ToolExe = "android";
ToolExe = "avdmanager";
var dirs = string.IsNullOrEmpty (ToolPath)
? null
@ -53,7 +53,7 @@ namespace Xamarin.Android.Tools.BootstrapTasks
string filename;
var path = Which.GetProgramLocation (ToolExe, out filename, dirs);
if (path == null) {
Log.LogError ($"Could not find `android`. Please set the `{nameof (CreateAndroidEmulator)}.{nameof (ToolPath)}` property appropriately.");
Log.LogError ($"Could not find `avdmanager`. Please set the `{nameof (CreateAndroidEmulator)}.{nameof (ToolPath)}` property appropriately.");
return null;
}
return path;
@ -64,16 +64,13 @@ namespace Xamarin.Android.Tools.BootstrapTasks
if (android == null)
return;
var arguments = $"create avd --abi \"{AndroidAbi}\" -f -n \"{ImageName}\" -t \"{TargetId}\"";
foreach (var line in Exec (android, arguments)) {
stdin.WriteLine ("no");
Log.LogMessage (MessageImportance.Low, line);
}
var arguments = $"create avd --abi {AndroidAbi} -f -n {ImageName} --package \"{TargetId}\"";
Exec (android, arguments);
}
StreamWriter stdin;
IEnumerable<string> Exec (string android, string arguments, DataReceivedEventHandler stderr = null)
void Exec (string android, string arguments, DataReceivedEventHandler stderr = null)
{
Log.LogMessage (MessageImportance.Low, $"Tool {android} execution started with arguments: {arguments}");
var psi = new ProcessStartInfo () {
@ -81,8 +78,8 @@ namespace Xamarin.Android.Tools.BootstrapTasks
Arguments = arguments,
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
RedirectStandardOutput = false,
RedirectStandardError = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
};
@ -100,16 +97,12 @@ namespace Xamarin.Android.Tools.BootstrapTasks
using (p) {
p.StartInfo = psi;
p.Start ();
p.BeginErrorReadLine ();
stdin = p.StandardInput;
string line;
while ((line = p.StandardOutput.ReadLine ()) != null) {
yield return line;
while (!p.HasExited) {
stdin.WriteLine ();
p.WaitForExit (1000);
}
p.WaitForExit ();
if (p.ExitCode != 0) {
Log.LogError ($"Process `{android}` exited with value {p.ExitCode}.");
}
@ -120,7 +113,10 @@ namespace Xamarin.Android.Tools.BootstrapTasks
{
if (string.IsNullOrEmpty (e.Data))
return;
Log.LogError ($"{e.Data}");
if (e.Data.StartsWith ("Warning:", StringComparison.Ordinal))
Log.LogMessage ($"{e.Data}");
else
Log.LogError ($"{e.Data}");
}
}
}

Просмотреть файл

@ -1,6 +1,6 @@
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
@ -60,8 +60,8 @@ namespace Xamarin.Android.Tools.BootstrapTasks
if (emulator == null)
return;
var port = string.IsNullOrEmpty (Port) ? "" : $" -port \"{Port}\"";
var arguments = $"-avd \"{ImageName}\"{port}";
var port = string.IsNullOrEmpty (Port) ? "" : $" -port {Port}";
var arguments = $"-avd {ImageName}{port}";
Log.LogMessage (MessageImportance.Low, $"Tool {emulator} execution started with arguments: {arguments}");
var psi = new ProcessStartInfo () {
FileName = emulator,
@ -71,10 +71,6 @@ namespace Xamarin.Android.Tools.BootstrapTasks
WindowStyle = ProcessWindowStyle.Hidden,
};
Log.LogMessage (MessageImportance.Low, $"Environment variables being passed to the tool:");
if (!string.IsNullOrEmpty (AndroidSdkHome)) {
psi.EnvironmentVariables ["ANDROID_SDK_HOME"] = AndroidSdkHome;
Log.LogMessage (MessageImportance.Low, $"\tANDROID_SDK_HOME=\"{AndroidSdkHome}\"");
}
var p = new Process () {
StartInfo = psi,
};

Просмотреть файл

@ -1,4 +1 @@
java/JavaLib/build.xml
java/JavaLib/gen
java/JavaLib/local.properties
libs

Просмотреть файл

@ -23,7 +23,7 @@ using Android.App;
[assembly: Android.IncludeAndroidResourcesFromAttribute ("./",
SourceUrl="file:///JavaLib.zip")]
[assembly: Java.Interop.JavaLibraryReference ("bin/classes.jar",
[assembly: Java.Interop.JavaLibraryReference ("classes.jar",
SourceUrl="file:///JavaLib.zip")]
// native library path should contain abi

Просмотреть файл

@ -78,7 +78,7 @@
<AndroidNativeLibrary Include="libs\x86_64\libsimple.so" />
</ItemGroup>
<ItemGroup>
<InputJar Include="java\JavaLib\bin\classes.jar">
<InputJar Include="java\JavaLib\library\build\intermediates\bundles\debug\classes.jar">
<Link>Jars\classes.jar</Link>
</InputJar>
</ItemGroup>

Просмотреть файл

@ -42,19 +42,17 @@
DependsOnTargets="AndroidPrepareForBuild"
Inputs="java\JavaLib\project.properties"
Outputs="$(OutputPath)JavaLib.zip">
<Exec
Command="&quot;$(AndroidSdkDirectory)\tools\android&quot; update project -p ."
WorkingDirectory="java\JavaLib"
<WriteLinesToFile
Overwrite="true"
File="java\JavaLib\local.properties"
Lines="sdk.dir=$(AndroidSdkDirectory)"
/>
<Exec
Command="$(AntDirectory)\bin\ant debug"
WorkingDirectory="java\JavaLib"
Command=".\gradlew assembleDebug --stacktrace"
WorkingDirectory="$(MSBuildThisFileDirectory)java\JavaLib"
/>
<MakeDir Directories="$(OutputPath)" />
<Exec
Command="zip -r ../../$(OutputPath)JavaLib.zip bin res AndroidManifest.xml"
WorkingDirectory="java\JavaLib"
/>
<Copy SourceFiles="java\JavaLib\library\build\outputs\aar\library-debug.aar" DestinationFiles="$(OutputPath)JavaLib.zip" />
</Target>
<Target Name="CleanLocal">
<RemoveDir Directories="java\JavaLib\bin;java\JavaLib\gen;bin;obj;libs;simple2\libs" />

Просмотреть файл

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.javalib"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.javalib.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Просмотреть файл

@ -0,0 +1,24 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.4.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,6 @@
#Tue Mar 28 18:41:16 JST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip

Просмотреть файл

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

Просмотреть файл

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Просмотреть файл

@ -0,0 +1 @@
/build

Просмотреть файл

@ -0,0 +1,26 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}

Просмотреть файл

@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/atsushi/android-sdk-linux/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

Просмотреть файл

@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.javalib">
</manifest>

Просмотреть файл

@ -0,0 +1,24 @@
package com.example.javalib;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public static int GetActionSettings() {
return R.id.action_settings;
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 6.0 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 9.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 14 KiB

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

Просмотреть файл

@ -0,0 +1 @@
include ':library'