Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] Add XA1025 error for Hybrid AOT on arme…
Browse files Browse the repository at this point in the history
…abi-v7a

Context: #1218 (comment)

The undocumented, experimental `Hybrid` value for the
`$(AndroidAotMode)` MSBuild property is not currently compatible with
the armeabi-v7a target ABI.  Attempting to run an app built with
`$(AndroidAotMode)`=`Hybrid` in an armeabi-v7a environment results in a
crash.

Since it is known that this configuration currently produces a crash,
emit a build error for it to improve the visibility of the known issue
and reduce the time users might spend searching for the cause of the
crash.

Example of the current crash:

	F libc    : Fatal signal 11 (SIGSEGV), code 2, fault addr 0x913a50c8 in tid 31140 (ppxamarinforms1)
	W         : debuggerd: handling request: pid=31140 uid=10146 gid=10146 tid=31140
	F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
	F DEBUG   : Build fingerprint: 'motorola/perry_metropcs_c/perry:7.1.1/NCQS26.69-64-21/33:user/release-keys'
	F DEBUG   : Revision: 'p3b0'
	F DEBUG   : ABI: 'arm'
	F DEBUG   : pid: 31140, tid: 31140, name: ppxamarinforms1  >>> com.companyname.mobileappxamarinforms1 <<<
	F DEBUG   : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x913a50c8
	F DEBUG   :     r0 be9384d4  r1 00000000  r2 be9385a0  r3 9320b1c0
	F DEBUG   :     r4 00000000  r5 94167208  r6 00000000  r7 be938584
	F DEBUG   :     r8 be938838  r9 ae040008  sl 00000000  fp be9385a0
	F DEBUG   :     ip 913a50c8  sp be9384e4  lr 942a8420  pc 913a50c8  cpsr 000f0010
	F DEBUG   :
	F DEBUG   : backtrace:
	F DEBUG   :     #00 pc 000250c8  [anon:libc_malloc:91380000]
	F DEBUG   :     #1 pc 0000141c  <anonymous:942a7000>
	W ActivityManager: Activity pause timeout for ActivityRecord{7ded4d1 u0 com.companyname.mobileappxamarinforms1/crc64e53dff5578afb8f2.MainActivity t5740}
	I ActivityManager: Killing 30471:com.google.android.apps.fireball/u0a145 (adj 906): empty #13
	D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ LISTEN id=624, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ], android.os.BinderProxy@f4c4e10)
	D ActivityManager: cleanUpApplicationRecord -- 30471
	E ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [ LISTEN id=624, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ]
	W         : debuggerd: resuming target 31140
	I BootReceiver: Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
	W ActivityManager:   Force finishing activity com.companyname.mobileappxamarinforms1/crc64e53dff5578afb8f2.MainActivity
	I Zygote  : Process 31140 exited due to signal (11)

Other changes:

Update the `HybridAOT` test to cover the new error.

Add a new `AndroidAotModeHybridAbortsOnArmeabiV7a` on-device test to
remind the team to remove the error if hybrid AOT becomes compatible
with armeabi-v7a in the future.

Correct the `BuildIncrementalAot` test so that it sets
`$(AndroidSupportedAbis)`.  A side effect is that the test cases that
use `$(AndroidAotMode)`=`Full` now build successfully.  Note that
although those test cases now build successfully, the resulting app
packages abort when run on device because Xamarin.Android requires JIT
compilation:

	Unhandled Exception:
	System.ExecutionEngineException: Attempting to JIT compile method '(wrapper other) void Java.Interop.JavaVMInterface:PtrToStructure (intptr,object)' while running in aot-only mode.

TODO: Add a build error for `$(AndroidAotMode)`=`Full`, likely by
updating error XA3002.
  • Loading branch information
brendanzagaeski committed Nov 12, 2020
1 parent 77d4af8 commit 83403ae
Show file tree
Hide file tree
Showing 21 changed files with 206 additions and 3 deletions.
1 change: 1 addition & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Please disable fast deployment in the Visual Studio project property pages or ed
+ XA1022: Specified reference Java library not found: {file}
+ [XA1023](xa1023.md): Using the DX DEX Compiler is deprecated.
+ [XA1024](xa1024.md): Ignoring configuration file 'Foo.dll.config'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.
+ [XA1025](xa1025.md): The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI.
+ [XA1027](xa1027.md): The 'EnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.
+ [XA1028](xa1028.md): The 'AndroidEnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.

Expand Down
47 changes: 47 additions & 0 deletions Documentation/guides/messages/xa1025.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: Xamarin.Android error XA1025
description: XA1025 error code
ms.date: 11/08/2020
---
# Xamarin.Android error XA1025

## Example messages

```
error XA1025: The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild
property is not currently compatible with the armeabi-v7a target ABI. To
continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect
the armeabi-v7a target ABI in the Visual Studio project property pages or edit
the project file in a text editor and remove 'armeabi-v7a' from the
'AndroidSupportedAbis' MSBuild property.
```

## Issue

The project has the `AndroidAotMode` MSBuild property set to the experimental
`Hybrid` value and also includes the value `armeabi-v7a` in the
`AndroidSupportedAbis` MSBuild property. Applications built with
`AndroidAotMode` set to `Hybrid` currently abort during startup on armeabi-v7a
devices, so the build exits with an error if this configuration is found.

## Solution

If armeabi-v7a device compatibility is required for the app, the
`AndroidAotMode` MSBuild property should be set to `Normal` or removed from the
project file completely. To adjust the value of the `AndroidAotMode` MSBuild
property, edit the project file in a text editor.

If armeabi-v7a device compatibility is not required for the app, then deselect
the **armeabi-v7a** target ABI in the Visual Studio project property pages to
resolve the build error.

In Visual Studio, the target ABIs can be adjusted under **Supported
architectures** in the **Advanced** section of the **Android Options** tab of
the project property pages

In Visual Studio for Mac, the target ABIs can be adjusted under **Supported
ABIs** in the **Advanced** tab of the **Android Build** section of the project
property pages.

Alternatively, edit the project file in a text editor and remove `armeabi-v7a`
from the `AndroidSupportedAbis` MSBuild property by hand.
42 changes: 42 additions & 0 deletions Documentation/release-notes/xa1025.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#### Deprecations, removals, and default configuration changes

- [XA1025 error for Hybrid AndroidAotMode with incompatible armeabi-v7a target ABI](#xa1025-error-for-hybrid-androidaotmode-with-incompatible-armeabiv7a-target-abi)

### XA1025 error for Hybrid AndroidAotMode with incompatible armeabi-v7a target ABI

```
error XA1025: The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild
property is not currently compatible with the armeabi-v7a target ABI. To
continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect
the armeabi-v7a target ABI in the Visual Studio project property pages or edit
the project file in a text editor and remove 'armeabi-v7a' from the
'AndroidSupportedAbis' MSBuild property.
```

Projects using the experimental `Hybrid` value for the `AndroidAotMode` MSBuild
property that also include the value `armeabi-v7a` in the `AndroidSupportedAbis`
MSBuild property will now see this build error to help indicate that
applications built with these settings would abort during startup on armeabi-v7a
ABI device environments ([GitHub Issue 1218][github-1218]).

If armeabi-v7a device compatibility is required for the app, the
`AndroidAotMode` MSBuild property should be set to `Normal` or removed from the
project file completely. To adjust the value of the `AndroidAotMode` MSBuild
property, edit the project file in a text editor.

If armeabi-v7a device compatibility is not required for the app, then deselect
the **armeabi-v7a** target ABI in the Visual Studio project property pages to
resolve the build error.

In Visual Studio, the target ABIs can be adjusted under **Supported
architectures** in the **Advanced** section of the **Android Options** tab of
the project property pages

In Visual Studio for Mac, the target ABIs can be adjusted under **Supported
ABIs** in the **Advanced** tab of the **Android Build** section of the project
property pages.

Alternatively, edit the project file in a text editor and remove `armeabi-v7a`
from the `AndroidSupportedAbis` MSBuild property by hand.

[github-1218]: https://github.com/xamarin/xamarin-android/issues/1218
4 changes: 4 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,10 @@ In this message, the term "binding" means a piece of generated code that makes i
<comment>The following are literal names and should not be translated: .NET, Xamarin.Android.
{0} - The file name such as 'Foo.dll.config'</comment>
</data>
<data name="XA1025" xml:space="preserve">
<value>The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</value>
<comment>The following are literal names and should not be translated: 'Hybrid', 'AndroidAotMode', armeabi-v7a, 'AndroidSupportedAbis'</comment>
</data>
<data name="XA1026" xml:space="preserve">
<value>Using AAPT is deprecated in favor of AAPT2. Please enable 'Use incremental Android packaging system (aapt2)' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidUseAapt2' MSBuild property to 'true'.</value>
<comment>The following are literal names and should not be translated: AAPT, AAPT2, Android, AndroidUseAapt2, true.</comment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ In this message, the term "binding" means a piece of generated code that makes i
<note>The following are literal names and should not be translated: .NET, Xamarin.Android.
{0} - The file name such as 'Foo.dll.config'</note>
</trans-unit>
<trans-unit id="XA1025">
<source>The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</source>
<target state="new">The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</target>
<note>The following are literal names and should not be translated: 'Hybrid', 'AndroidAotMode', armeabi-v7a, 'AndroidSupportedAbis'</note>
</trans-unit>
<trans-unit id="XA2000">
<source>Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 5 will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 5 is released.</source>
<target state="translated">V sestavení {0} se zjistilo, že se používá AppDomain.CreateDomain(). .NET 5 bude podporovat jen jednu doménu AppDomain, proto toto rozhraní API už nebude po vydání rozhraní .NET 5 v Xamarin.Androidu k dispozici.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ In this message, the term "binding" means a piece of generated code that makes i
<note>The following are literal names and should not be translated: .NET, Xamarin.Android.
{0} - The file name such as 'Foo.dll.config'</note>
</trans-unit>
<trans-unit id="XA1025">
<source>The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</source>
<target state="new">The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</target>
<note>The following are literal names and should not be translated: 'Hybrid', 'AndroidAotMode', armeabi-v7a, 'AndroidSupportedAbis'</note>
</trans-unit>
<trans-unit id="XA2000">
<source>Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 5 will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 5 is released.</source>
<target state="translated">In der Assembly "{0}" wurde die Verwendung von "AppDomain.CreateDomain()" festgestellt. .NET 5 unterstützt nur eine einzelne AppDomain, sodass diese API nach dem Release von .NET 5 nicht mehr in Xamarin.Android verfügbar ist.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ In this message, the term "binding" means a piece of generated code that makes i
<note>The following are literal names and should not be translated: .NET, Xamarin.Android.
{0} - The file name such as 'Foo.dll.config'</note>
</trans-unit>
<trans-unit id="XA1025">
<source>The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</source>
<target state="new">The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</target>
<note>The following are literal names and should not be translated: 'Hybrid', 'AndroidAotMode', armeabi-v7a, 'AndroidSupportedAbis'</note>
</trans-unit>
<trans-unit id="XA2000">
<source>Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 5 will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 5 is released.</source>
<target state="translated">Se detectó el uso de AppDomain.CreateDomain() en el ensamblado: {0}. En .NET 5 solo se admitirá una instancia de AppDomain, por lo que esta API ya no estará disponible en Xamarin.Android una vez que se haya lanzado .NET 5.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ In this message, the term "binding" means a piece of generated code that makes i
<note>The following are literal names and should not be translated: .NET, Xamarin.Android.
{0} - The file name such as 'Foo.dll.config'</note>
</trans-unit>
<trans-unit id="XA1025">
<source>The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</source>
<target state="new">The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</target>
<note>The following are literal names and should not be translated: 'Hybrid', 'AndroidAotMode', armeabi-v7a, 'AndroidSupportedAbis'</note>
</trans-unit>
<trans-unit id="XA2000">
<source>Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 5 will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 5 is released.</source>
<target state="translated">Utilisation de AppDomain.CreateDomain() détectée dans l'assembly {0}. .NET 5 prend uniquement en charge un seul AppDomain. Cette API ne sera donc plus disponible dans Xamarin.Android après la publication de .NET 5.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ In this message, the term "binding" means a piece of generated code that makes i
<note>The following are literal names and should not be translated: .NET, Xamarin.Android.
{0} - The file name such as 'Foo.dll.config'</note>
</trans-unit>
<trans-unit id="XA1025">
<source>The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</source>
<target state="new">The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</target>
<note>The following are literal names and should not be translated: 'Hybrid', 'AndroidAotMode', armeabi-v7a, 'AndroidSupportedAbis'</note>
</trans-unit>
<trans-unit id="XA2000">
<source>Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 5 will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 5 is released.</source>
<target state="translated">È stato rilevato l'uso di AppDomain.CreateDomain() nell'assembly: {0}. .NET 5 supporterà solo un'unica istanza di AppDomain, di conseguenza questa API non sarà più disponibile in Xamarin.Android dopo il rilascio di .NET 5.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ In this message, the term "binding" means a piece of generated code that makes i
<note>The following are literal names and should not be translated: .NET, Xamarin.Android.
{0} - The file name such as 'Foo.dll.config'</note>
</trans-unit>
<trans-unit id="XA1025">
<source>The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</source>
<target state="new">The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</target>
<note>The following are literal names and should not be translated: 'Hybrid', 'AndroidAotMode', armeabi-v7a, 'AndroidSupportedAbis'</note>
</trans-unit>
<trans-unit id="XA2000">
<source>Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 5 will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 5 is released.</source>
<target state="translated">アセンブリ {0} で AppDomain.CreateDomain() が使用されていることが検出されました。.NET 5 では単一の AppDomain のみがサポートされる予定のため、.NET 5 がリリースされるとこの API は Xamarin.Android では使用できなくなります。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ In this message, the term "binding" means a piece of generated code that makes i
<note>The following are literal names and should not be translated: .NET, Xamarin.Android.
{0} - The file name such as 'Foo.dll.config'</note>
</trans-unit>
<trans-unit id="XA1025">
<source>The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</source>
<target state="new">The experimental 'Hybrid' value for the 'AndroidAotMode' MSBuild property is not currently compatible with the armeabi-v7a target ABI. To continue using the experimental 'Hybrid' value for 'AndroidAotMode', deselect the armeabi-v7a target ABI in the Visual Studio project property pages or edit the project file in a text editor and remove 'armeabi-v7a' from the 'AndroidSupportedAbis' MSBuild property.</target>
<note>The following are literal names and should not be translated: 'Hybrid', 'AndroidAotMode', armeabi-v7a, 'AndroidSupportedAbis'</note>
</trans-unit>
<trans-unit id="XA2000">
<source>Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 5 will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 5 is released.</source>
<target state="translated">{0} 어셈블리에서 AppDomain.CreateDomain() 사용이 검색되었습니다. .NET 5는 단일 AppDomain만 지원하므로 .NET 5가 릴리스되면 이 API는 Xamarin.Android에서 더는 사용할 수 없습니다.</target>
Expand Down
Loading

0 comments on commit 83403ae

Please sign in to comment.