Skip to content

Commit

Permalink
Fast Dev V2
Browse files Browse the repository at this point in the history
use AndroidIncludeDebugSymbols for _RemoveRegisterAttribute. Fixes dotnet#5009
  • Loading branch information
dellis1972 committed Sep 3, 2020
1 parent 799f141 commit 9be5bcb
Show file tree
Hide file tree
Showing 95 changed files with 319 additions and 643 deletions.
2 changes: 1 addition & 1 deletion .external
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
xamarin/monodroid:master@92b9cce8dacad8b7ce48ddbcf9e5247598cd2ccd
xamarin/monodroid:fastdevv2@e3ac56d34a58cb8239606b0e889ccfcd581e3db6
mono/mono:2020-02@83105ba22461455f4343d6bb14976eba8b0b3f39
22 changes: 0 additions & 22 deletions Documentation/guides/BuildProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ In broad terms, there are two types of Android application packages
Not coincidentally, these match the MSBuild `Configuration` which
produces the package.

### Shared Runtime

The *shared runtime* is a pair of additional Android packages which
provide the Base Class Library (`mscorlib.dll`, etc.) and the
Android binding library (`Mono.Android.dll`, etc.). Debug builds
rely upon the shared runtime in lieu of including the Base Class Library and
Binding assemblies within the Android application package, allowing the
Debug package to be smaller.

The shared runtime may be disabled in Debug builds by setting the
`$(AndroidUseSharedRuntime)` property to `False`.

<a name="Fast_Deployment" />

### Fast Deployment
Expand Down Expand Up @@ -856,16 +844,6 @@ when packaging Release applications.

Added in Xamarin.Android 8.1.

- **AndroidUseSharedRuntime** &ndash; A boolean property that is
determines whether the *shared runtime packages* are required in
order to run the Application on the target device. Relying on the
shared runtime packages allows the Application package to be
smaller, speeding up the package creation and deployment process,
resulting in a faster build/deploy/debug turnaround cycle.

This property should be `True` for Debug builds, and `False` for
Release projects.

- **AndroidVersionCodePattern** &ndash; A string property which allows
the developer to customize the `versionCode` in the manifest.
See [Creating the Version Code for the APK](~/android/deploy-test/building-apps/abi-specific-apks.md)
Expand Down
5 changes: 5 additions & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ ms.date: 01/24/2020
+ [XA0122](xa0122.md): Assembly '{assembly}' is using a deprecated attribute '[assembly: Java.Interop.DoNotPackageAttribute]'. Use a newer version of this NuGet package or notify the library author.
+ XA0123: Removing {issue} from {propertyName}. Lint {version} does not support this check.
+ [XA0124](xa0124.md): Interpreter is not supported by the x86 ABI
+ [XA0125](xa0125.md): Sorry. This device does not support Fast Deployment. Please rebuild your app using `EmbedAssembliesIntoApk = True`.
+ [XA0126](xa0126.md): Error installing FastDev Tools. This device does not support Fast Deployment. Please rebuild your app using `EmbedAssembliesIntoApk = True`.
+ [XA0127](xa0127.md): There was an issue deploying {destination} using {FastDevTool}. We encountered the following error {output}. Please rebuild your app using `EmbedAssembliesIntoApk = True`.
+ [XA0128](xa0128.md): Stdio Redirection is enabled. Please disable it to use Fast Deployment.

## XA1xxx: Project related

Expand Down Expand Up @@ -233,6 +237,7 @@ and `NNN` is a 3 digit number indicating the type of the unhandled `Exception`.
* `DES` - `Desugar`
* `DJL` - `DetermineJavaLibrariesToCompile`
* `DX8` - `D8`
* `FD` - `FastDeploy`
* `FLB` - `FindLayoutsToBind`
* `FLT` - `FilterAssemblies`
* `GAD` - `GetAndroidDefineConstants`
Expand Down
2 changes: 0 additions & 2 deletions Documentation/guides/messages/xa0119.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ Remove the following options from `Debug` configurations:

* `<AndroidLinkMode>None</AndroidLinkMode>`
* `<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>`
* `<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>`

*DO* use the following options for `Release` configurations:

* `<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>`
* `<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>`

Consider submitting a [bug][bug] if you are getting one of these
warnings under normal circumstances.
Expand Down
20 changes: 20 additions & 0 deletions Documentation/guides/messages/xa0125.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Xamarin.Android error XA0125
description: XA0125 error code
ms.date: 08/07/2020
---
# Xamarin.Android error XA0125

## Issue

This issue happens when you are trying to use fast deployment on a device which
does not support it. Fast deployment requires features which are not available
on devices running API 20 or lower. The Fast Deployment system makes use of the
`run-as` feature of the Android OS. This feature was either not available or had
limited capabilities in API 20 and earlier.

## Solution

Disable Fast Deployment by setting `EmbedAssembliesIntoApk = True` in your .csproj.
Or turn off `Fast Deployment` in the IDE. You will still be able to debug on the device,
all the required files will be packaged inside the .apk.
20 changes: 20 additions & 0 deletions Documentation/guides/messages/xa0126.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Xamarin.Android error XA0126
description: XA0126 error code
ms.date: 08/07/2020
---
# Xamarin.Android error XA0126

## Issue

This issue happens when you are trying to use fast deployment on a device which
does not support it. Fast deployment requires features which are not available
on devices running API 20 or lower. The Fast Deployment system makes use of the
`run-as` feature of the Android OS. This feature was either not available or had
limited capabilities in API 20 and earlier.

## Solution

Disable Fast Deployment by setting `EmbedAssembliesIntoApk = True` in your .csproj.
Or turn off `Fast Deployment` in the IDE. You will still be able to debug on the device,
all the required files will be packaged inside the .apk.
19 changes: 19 additions & 0 deletions Documentation/guides/messages/xa0127.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Xamarin.Android error XA0127
description: XA0127 error code
ms.date: 08/07/2020
---
# Xamarin.Android error XA0127

## Issue

If you encounter this issue something unexpected happened with the Fast Deployment
native tooling. This is most likely to be a native crash.

## Solution

To work around the issue disable Fast Deployment by setting `EmbedAssembliesIntoApk = True`
in your .csproj. Or turn off `Fast Deployment` in the IDE. You will still be able to debug
on the device, all the required files will be packaged inside the .apk.

In addition raise an issue at [https://github.com/xamarin/xamarin-android/issues/new/choose](https://github.com/xamarin/xamarin-android/issues/new/choose). Please provide the deployment log and as much detail as possible.
26 changes: 26 additions & 0 deletions Documentation/guides/messages/xa0128.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: Xamarin.Android error XA0128
description: XA0128 error code
ms.date: 08/07/2020
---
# Xamarin.Android error XA0128

## Issue

The Fast Deployment system relys on reading the output from the various system applications
on the device. This is done by reading `System.out`, which by default is where all output
will be redirected. If `log.redirect-stdio` this will cause all of the Fast Deployment tooling
to fail.

## Solution

Disable the redirection of stdio in order to use Fast Deployment. This can be done using
the following commands.

```
adb shell stop
adb shell setprop log.redirect-stdio false
adb shell start
```

Depending on the device you might need to run `adb root` before running the above commands.
15 changes: 15 additions & 0 deletions Documentation/release-notes/fastdeployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Fast Deployment Updates.

As part of this update the fast deplyment system used for Debugging apps has
been changed. The shared runtime is now no longer used or required.
The Platform package has also been make obsolete.

The new system also no longer uses the `external` drive for the fast deployment
files. All of the files and tooling are now stored in the applications' `internal`
directory. This has an advantage in that when the application is uninstalled all
if the files and the tooling will be removed as well.

The new system will not work on any devices older than API 21. This is because it
relys on features that only work from API 21 onwards. Also API 21 is the lowest
supported platform for the runtime, so running and debugging on older devices will
be impossible.
12 changes: 5 additions & 7 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<LibExtension Condition=" '$(HostOS)' == 'Windows' ">dll</LibExtension>
<IncludeMonoBundleComponents Condition="'$(IncludeMonoBundleComponents)' == ''">True</IncludeMonoBundleComponents>
<UseCommercialInstallerName Condition="'$(UseCommercialInstallerName)' == ''">False</UseCommercialInstallerName>
<_HasCommercialFiles Condition="Exists('$(MSBuildSrcDir)\Mono.Android.DebugRuntime-debug.apk')">True</_HasCommercialFiles>
<_HasCommercialFiles Condition="Exists('$(MSBuildSrcDir)\Xamarin.Android.Common.Debugging.targets')">True</_HasCommercialFiles>
</PropertyGroup>
<ItemGroup>
<_MsxDocAssembly Include="Mono.Android">
Expand Down Expand Up @@ -391,12 +391,6 @@
<_MSBuildFiles Include="$(MSBuildSrcDir)\jar2xml.jar" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Mono.AndroidTools.dll" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Mono.AndroidTools.pdb" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Mono.Android.DebugRuntime-arm64-v8a.apk" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Mono.Android.DebugRuntime-armeabi-v7a.apk" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Mono.Android.DebugRuntime-debug.apk" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Mono.Android.DebugRuntime-debug.xml" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Mono.Android.DebugRuntime-x86.apk" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Mono.Android.DebugRuntime-x86_64.apk" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Analysis.Compatibility.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Analysis.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Analysis.Tasks.dll" />
Expand All @@ -421,6 +415,10 @@
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Installer.Common.dll" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Installer.Common.pdb" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Installer.Common.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\K4os.Compression.LZ4.dll" />
<_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\xamarin.sync')" />
<_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\xamarin.find')" />
<_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MSBuildSrcDir)\lib\%(Identity)\xamarin.stat')" />
<LegacyTargetsFiles Include="$(RootBuildDir)\lib\xamarin.android\xbuild\Novell\Xamarin.Android.Bindings.targets" />
<LegacyTargetsFiles Include="$(RootBuildDir)\lib\xamarin.android\xbuild\Novell\Xamarin.Android.VisualBasic.targets" />
</ItemGroup>
Expand Down
4 changes: 0 additions & 4 deletions build-tools/proprietary/proprietary.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<Link>$(_DestinationDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(_SourceDir)Mono.Android.DebugRuntime-*.apk">
<Link>$(_DestinationDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(_SourceDir)Mono.AndroidTools.*">
<Link>$(_DestinationDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
4 changes: 1 addition & 3 deletions samples/HelloWorld/HelloLibrary/HelloLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Bundle|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Bundle\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
</PropertyGroup>
<ItemGroup>
Expand All @@ -60,7 +58,7 @@
<Compile Include="LibraryActivity.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
Expand Down
1 change: 0 additions & 1 deletion samples/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ public boolean onCreate ()
@Override
public void attachInfo (android.content.Context context, android.content.pm.ProviderInfo info)
{
String incrementalDeploymentDir = new File (
android.os.Environment.getExternalStorageDirectory (),
"Android/data/" + context.getPackageName ()).getAbsolutePath ();
incrementalDeploymentDir = new File (incrementalDeploymentDir).exists ()
? incrementalDeploymentDir + "/files/"
: context.getFilesDir () + "/";
String incrementalDeploymentDir = context.getFilesDir () + "/";

File codeCacheDir = context.getCacheDir ();
String nativeLibDir = context.getApplicationInfo ().nativeLibraryDir;
Expand Down
1 change: 0 additions & 1 deletion src/Mono.Android/Test/Mono.Android-Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<AssemblyName>Mono.Android-Tests</AssemblyName>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidSupportedAbis>armeabi-v7a;x86</AndroidSupportedAbis>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<MandroidI18n>All</MandroidI18n>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\product.snk</AssemblyOriginatorKeyFile>
Expand Down
1 change: 0 additions & 1 deletion src/OpenTK-1.0/OpenTK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<AssemblyName>OpenTK-1.0</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<DefineConstants>MONODROID;MINIMAL;MOBILE;OPENTK_1;OPENTK_1_0</DefineConstants>
<NoWarn>3001,3002,3003,3005,3006,3021,3014,0618,1591,0414,0169,0419,1570,1572,1573,1635</NoWarn>
<NoStdLib>true</NoStdLib>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ Copyright (C) 2016 Xamarin. All rights reserved.
TypemapOutputDirectory="$(_NativeAssemblySourceDir)"
GenerateNativeAssembly="false"
MergedAndroidManifestOutput="$(_ManifestOutput)"
UseSharedRuntime="$(AndroidUseSharedRuntime)"
EmbedAssemblies="$(EmbedAssembliesIntoApk)"
BundledWearApplicationName="$(BundledWearApplicationPackageName)"
PackageNamingPolicy="$(AndroidPackageNamingPolicy)"
Expand Down Expand Up @@ -123,7 +122,6 @@ Copyright (C) 2016 Xamarin. All rights reserved.
MainAssembly="$(MonoAndroidLinkerInputDir)$(TargetFileName)"
OutputDirectory="$(_AndroidIntermediateJavaSourceDirectory)mono"
EnvironmentOutputDirectory="$(_AndroidIntermediateJavaSourceDirectory)mono\android\app"
UseSharedRuntime="$(AndroidUseSharedRuntime)"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
Manifest="$(IntermediateOutputPath)android\AndroidManifest.xml"
Environments="@(AndroidEnvironment);@(LibraryEnvironments)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This file is only used by "legacy" Xamarin.Android projects.
Value="AndroidKeyStore=True;AndroidSigningKeyStore=$([System.IO.Path]::GetFullPath ('$(AndroidSigningKeyStore)'));AndroidSigningStorePass=$(AndroidSigningStorePass);AndroidSigningKeyAlias=$(AndroidSigningKeyAlias);AndroidSigningKeyPass=$(AndroidSigningKeyPass)">
<Output TaskParameter="Value" PropertyName="_AdditionaEmbeddedWearAppProperties" />
</CreateProperty>
<MSBuild Projects="@(_AppExtensionReference)" Properties="Configuration=$(Configuration);AndroidUseSharedRuntime=False;EmbedAssembliesIntoApk=True;$(_AdditionaEmbeddedWearAppProperties)" Targets="Build;SignAndroidPackage"/>
<MSBuild Projects="@(_AppExtensionReference)" Properties="Configuration=$(Configuration);EmbedAssembliesIntoApk=True;$(_AdditionaEmbeddedWearAppProperties)" Targets="Build;SignAndroidPackage"/>
<CreateProperty
Condition="$(BundledWearApplicationApkPath) == '' And ($(WearAppTarget) == 'SignAndroidPackage' Or !Exists('%(_AppExtensionReference.RootDir)%(_AppExtensionReference.Directory)$(_AndroidDebugKeyStoreFlag)'))"
Value="%(_AppExtensionReference.RootDir)%(_AppExtensionReference.Directory)bin\$(Configuration)\$(BundledWearApplicationPackageName)-Signed.apk">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ _ResolveAssemblies MSBuild target.
<ProcessAssemblies
InputAssemblies="@(_ResolvedAssemblyFiles)"
ResolvedSymbols="@(_ResolvedSymbolFiles)"
UseSharedRuntime="$(AndroidUseSharedRuntime)"
IncludeDebugSymbols="$(AndroidIncludeDebugSymbols)"
LinkMode="$(AndroidLinkMode)">
<Output TaskParameter="OutputAssemblies" ItemName="_ProcessedAssemblies" />
<Output TaskParameter="ResolvedSymbols" ItemName="ResolvedSymbols" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@
<!-- User-facing configuration-specific defaults -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<!--FIXME: Disable the shared runtime and fast deployment default -->
<AndroidUseSharedRuntime Condition=" '$(AndroidUseSharedRuntime)' == '' ">false</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' ">true</EmbedAssembliesIntoApk>
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' ">false</EmbedAssembliesIntoApk>
<AndroidLinkMode Condition=" '$(AndroidLinkMode)' == '' ">None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<AndroidUseSharedRuntime Condition=" '$(AndroidUseSharedRuntime)' == '' ">false</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' ">true</EmbedAssembliesIntoApk>
<AndroidLinkMode Condition=" '$(AndroidLinkMode)' == '' ">SdkOnly</AndroidLinkMode>
<AndroidManagedSymbols Condition=" '$(AndroidManagedSymbols)' == '' ">true</AndroidManagedSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

<!-- Default item includes (globs and implicit references) -->
<Import Project="Microsoft.Android.Sdk.DefaultItems.targets" />
<Import Project="$(MSBuildThisFileDirectory)..\tools\Xamarin.Android.Common.Debugging.props"
Condition="Exists('$(MSBuildThisFileDirectory)..\tools\Xamarin.Android.Common.Debugging.props')"/>
<!-- Build ordering, should be imported before Xamarin.Android.Common.targets -->
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Android.Sdk.BuildOrder.targets" />

Expand All @@ -39,7 +41,7 @@
<ProjectCapability Include="Mobile" />
<ProjectCapability Include="Android" />
<ProjectCapability Include="AndroidApplication" Condition="$(AndroidApplication)" />

<!-- Conflicts with our targets generator in VS+CPS: See https://work.azdo.io/1112733 -->
<ProjectCapability Remove="LaunchProfiles" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 9be5bcb

Please sign in to comment.