Mac Android Studio App Sdk Location

-->

Visual Studio includes an Android SDK Manager that you useto download Android SDK tools, platforms, and other components that youneed for developing Xamarin.Android apps.

In Android Studio, click Debug, and select your running device to install the app to that device. Note: Adding the Javadocs to your project in Android Studio is not currently an option for the Amazon Android SDKs because Android Studio requires that the Javadocs be available as their own JAR file, which is not currently available as part of. Flutter relies on a full installation of Android Studio to supply its Android platform dependencies. However, you can write your Flutter apps in a number of editors. Install Android Studio. Download and install Android Studio. Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK. This installs the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android. Set up your Android device To prepare to run and test your Flutter app on an Android device, you need an Android device running Android. Check that Android Studio can connect to the Android Emulator. To check if the issue is being caused by a connection problem between Android Studio and the Android Emulator, follow these steps: Open the AVD Manager. Create a new AVD if you don't already have one. Run the emulator using your AVD.

Overview

This guide explains how to use the Xamarin Android SDK Manager inVisual Studio and Visual Studio for Mac.

Note

This guide applies to Visual Studio 2019, Visual Studio 2017, and Visual Studio for Mac.

The Xamarin Android SDK Manager (installed as part of the Mobiledevelopment with .NET workload) helps you download the latest Androidcomponents that you need for developing your Xamarin.Android app. Itreplaces Google's standalone SDK Manager, which has been deprecated.

Requirements

To use the Xamarin Android SDK Manager, you will need the following:

  • Visual Studio 2019 Community, Professional, or Enterprise.

  • OR Visual Studio 2017 (Community, Professional, or Enterprise edition). VisualStudio 2017 version 15.7 or later is required.

  • Visual Studio Tools for Xamarin version 4.10.0 or later(installed as part of the Mobile development with .NET workload).

The Xamarin Android SDK Manager also requires the Java Development Kit(which is automatically installed with Xamarin.Android). There areseveral JDK alternatives to choose from:

  • By default, Xamarin.Android usesJDK 8,which is required if you are developing for API level 24 or greater(JDK 8 also supports API levels earlier than 24).

  • You can continue to use JDK 7if you are developing specifically for API level 23 or earlier.

  • If you are using Visual Studio 15.8 Preview 5 or later, you can tryusing Microsoft's Mobile OpenJDK Distributionrather than JDK 8.

SDK Manager

To start the SDK Manager in Visual Studio, click Tools > Android >Android SDK Manager:

The Android SDK Manager opens in the Android SDKs andTools screen. This screen has two tabs – Platforms andTools:

The Android SDKs and Tools screen is described in more detail inthe following sections.

Android SDK location

The Android SDK location is configured at the top of the Android SDKsand Tools screen, as seen in the previous screenshot. This location mustbe configured correctly before the Platforms and Tools tabswill function properly. You may need to set the location of the AndroidSDK for one or more of the following reasons:

  1. The Android SDK Manager was unable to locate the Android SDK.

  2. You have installed the Android SDK in a alternate (non-default) location.

To set the location of the Android SDK, click the ellipsis (…)button to the far right of Android SDK Location. This opens theBrowse For Folder dialog to use for navigating to the location ofthe Android SDK. In the following screenshot, the Android SDK underProgram Files (x86)Android is being selected:

When you click OK, the SDK Manager will manage the Android SDK thatis installed at the selected location.

Tools tab

The Tools tab displays a list of tools and extras. Use this tabto install the Android SDK tools, platform tools, and build tools.Also, you can install the Android Emulator, the low-level debugger(LLDB), the NDK, HAXM acceleration, and Google Play libraries.

For example, to download the Google Android Emulator package, click thecheck mark next to Android Emulator and click the Apply Changesbutton:

A dialog may be shown with the message, The following package requiresthat you accept its license terms before installing:

Click Accept if you accept the Terms and Conditions. At the bottomof the window, a progress bar indicates download and installationprogress. After the installation completes, the Tools tab will showthat the selected tools and extras were installed.

Platforms tab

The Platforms tab displays a list of platform SDK versions alongwith other resources (like system images) for each platform:

This screen lists the Android version (such as Android 8.0), thecode name (Oreo), the API level (such as 26), and the sizes ofthe components for that platform (such as 1 GB). You use thePlatforms tab to install components for the Android API level thatyou want to target. For more information about Android versions and APIlevels, seeUnderstanding Android API Levels.

When all components of a platform are installed, a checkmark appears nextto the platform name. If not all components of a platform areinstalled, the box for that platform is filled.You can expand a platform to see its components (and which componentsare installed) by clicking the + box to the left of the platform.Click - to unexpand the component listing for a platform.

To add another platform to the SDK, click the box next to the platformuntil the checkmark appears to install all of its components, thenclick Apply Changes:

To install only specific components, click the box next to the platformonce. You can then select any individual components that you need:

Notice that the number of components to install appears next to theApply Changes button. After you click the Apply Changes button,you will see the License Acceptance screen as shown earlier.Click Accept if you accept the Terms and Conditions. You may seethis dialog more than one time when there are multiple components toinstall. At the bottom of the window, a progress bar will indicatedownload and installation progress. When the download and installationprocess completes (this can take many minutes, depending on how manycomponents need to be downloaded), the added components are marked witha checkmark and listed as Installed.

Repository selection

By default, the Android SDK Manager downloads platform components andtools from a Microsoft-managed repository. If you need access toexperimental alpha/beta platforms and tools that are not yet availablein the Microsoft repository, you can switch the SDK Manager to useGoogle's repository. To make this switch, click the gear icon in thelower right-hand corner and select Repository > Google(Unsupported):

When the Google repository is selected, additional packages may appearin the Platforms tab that were not available previously. (In theabove screenshot, Android SDK Platform 28 was added by switching tothe Google repository.) Keep in mind that use of the Google repositoryis unsupported and is therefore not recommended for everydaydevelopment.

To switch back to the supported repository of platforms and tools,click Microsoft (Recommended). This restores the list of packagesand tools to the default selection.

Requirements

To use the Xamarin Android SDK Manager, you will need the following:

  • Visual Studio for Mac 7.5 (or later).

The Xamarin Android SDK Manager also requires the Java Development Kit(which is automatically installed with Xamarin.Android). There areseveral JDK alternatives to choose from:

  • By default, Xamarin.Android usesJDK 8,which is required if you are developing for API level 24 or greater(JDK 8 also supports API levels earlier than 24).

  • You can continue to use JDK 7if you are developing specifically for API level 23 or earlier.

  • If you are using Visual Studio for Mac 7.7 or later, you can tryusing Microsoft's Mobile OpenJDK Distributionrather than JDK 8.

Important

Xamarin.Android does not support JDK 9.

SDK Manager

To start the SDK Manager in Visual Studio for Mac, click Tools > SDK Manager:

The Android SDK Manager opens in the Preferences window, whichcontains three tabs, Platforms, Tools, and Locations:

The tabs of the Android SDK Manager are described in thefollowing sections.

Locations tab

The Locations tab has three settings for configuring the locationsof the Android SDK, Android NDK, and the Java SDK (JDK). Theselocations must be configured correctly before the Platforms andTools tabs will function properly.

When the SDK Manager starts, it automatically determines the path foreach installed package and indicates that it was Found by placing agreen checkmark icon next to the path:

Click the Reset to Defaults button to cause the SDK Manager to lookfor the SDK, NDK, and JDK at their default locations.

Typically, you use the Locations tab to modify the location of theAndroid SDK and/or the Java JDK. You do not need to install the NDK todevelop Xamarin.Android apps – the NDK is used only when you needto develop parts of your app using native-code languages such as C andC++.

Tools tab

The Tools tab displays a list of tools and extras. Use this tabto install the Android SDK tools, platform tools, and build tools.Also, you can install the Android Emulator, the low-level debugger(LLDB), the NDK, HAXM acceleration, and Google Play libraries.

For example, to download the Google Android Emulator package, click thecheck mark next to Android Emulator and click the Apply Changesbutton:

A dialog may be shown with the message, The following package requiresthat you accept its license terms before installing:

Click Accept if you accept the Terms and Conditions. At the bottomof the window, a progress bar indicates download and installationprogress. After the installation completes, the Tools tab will showthat the selected tools and extras were installed.

Platforms tab

The Platforms tab displays a list of platform SDK versions alongwith other resources (like system images) for each platform:

This screen lists the Android version (such as Android 8.1), thecode name (Oreo), the API level (such as 27), and the sizes ofthe components for that platform (such as 1 GB). You use thePlatforms tab to install components for the Android API level thatyou want to target. For more information about Android versions and APIlevels, see Understanding Android API Levels.

When all components of a platform are installed, a checkmark appears nextto the platform name. If not all components of a platform areinstalled, the box for that platform is filled.You can expand a platform to see its components (and which componentsare installed) by clicking the arrow to the left of the platform.Click down arrow to unexpand the component listing for a platform.

To add another platform to the SDK, click the box next to the platformuntil the checkmark appears to install all of its components, thenclick Apply Changes:

To install only some components, click the box next to the platformonce. You can then select any individual components that you need:

Notice that the number of components to install appears next to theApply Changes button. After you click the Apply Changes button,you will see the License Acceptance screen as shown earlier.Click Accept if you accept the Terms and Conditions. You may seethis dialog more than one time when there are multiple components toinstall. At the bottom of the window, a progress bar will indicatedownload and installation progress. When the download and installationprocess completes (this can take many minutes, depending on how manycomponents need to be downloaded), the added components are marked witha checkmark and listed as Installed.

Repository selection

By default, the Android SDK Manager downloads platform components andtools from a Microsoft-managed repository. If you need access toexperimental alpha/beta platforms and tools that are not yet availablein the Microsoft repository, you can switch the SDK Manager to useGoogle's repository. To make this switch, click the gear icon in thelower right-hand corner and select Repository > Google(Unsupported):

When the Google repository is selected, additional packages may appearin the Platforms tab that were not available previously. (In theabove screenshot, Android SDK Platform 28 was added by switching tothe Google repository.) Keep in mind that use of the Google repository isunsupported and is therefore not recommended for everyday development.

To switch back to the supported repository of platforms and tools,click Microsoft (Recommended). This restores the list of packagesand tools to the default selection.

Summary

This guide explained how to install and use the Xamarin Android SDKManager tool in Visual Studio and Visual Studio for Mac.

Related Links

-->

GitHub Developer Community System requirements Blogs

Important

This release is not 'go-live' and not intended for use on productioncomputers or for creating production code.

Installing

  • Visual Studio 2019 version 16.7 Preview — Visual Studio Installer
  • Visual Studio 2019 for Mac 8.7 Preview — Visual Studio for Mac Installerwith the Previewupdater channel

What's new in Xamarin.Android 11.0

Xamarin.Android 11.0 preview releases

  • July 14, 2020 — Xamarin.Android 11.0.0.3in Visual Studio 2019 version 16.7 Preview 4 and the Preview updater channelof Visual Studio 2019 for Mac version 8.7 Preview 4.
  • June 23, 2020 — Xamarin.Android 10.4.0.0in Visual Studio 2019 version 16.7 Preview 3 and the Preview updater channelof Visual Studio 2019 for Mac version 8.7 Preview 3.
  • June 2, 2020 — Xamarin.Android 10.3.99.259in Visual Studio 2019 version 16.7 Preview 2 and the Preview updater channelof Visual Studio 2019 for Mac version 8.7 Preview 2.
  • May 19, 2020 — Xamarin.Android 10.3.99.230in Visual Studio 2019 version 16.7 Preview 1 and the Preview updater channelof Visual Studio 2019 for Mac version 8.7 Preview 1.

Corresponding Visual Studio 2019 Preview release notes

July 14, 2020 — Xamarin.Android 11.0.0.3

This version is included in the Visual Studio 2019 version 16.7 Preview 4release and the Preview updater channel of Visual Studio 2019 for Mac version8.7 Preview 4.

In Xamarin.Android 11.0.0.3

Deprecations, removals, and default configuration changes

Bindings for Android 11 Beta

This version includes bindings for the Android 11 Beta fromGoogle. See the Android 11 Beta documentation foradditional information about the behavior and API changes in this new Androidversion. Because Android 11 Beta provides the finalized SDK and NDK APIs, theXamarin.Android bindings are now also finalized and the Xamarin.Android SDKversion number has been updated to 11.0. To use the bindings for the new APIsin a Xamarin.Android project, set Compile using Android version: (TargetFramework) to Android 11 (R) under the Application tab of the VisualStudio project property pages. This sets the TargetFrameworkVersion propertyto v11.0 in the .csproj file:

Note

The default and recommended Android SDK Build-Tools version forXamarin.Android is still 29 because Build-Tools version 30.0 currentlyrequires Java JDK 9 or higher, while both Xamarin.Android and Android Studiostill require JDK 8. Android SDK Build-Tools 29 is compatible with theAndroid 11 bindings, so it is recommended to continue using Android SDKBuild-Tools 29 for now.

Attempting to use Android SDK Build-Tools 30.0 with Java JDK 8 results in thefollowing error:

Project authors who wish to try Android SDK Build-Tools 30.0 can follow thesteps under Preliminary Java JDK 11 compatibility to install andconfigure Java JDK 11.

Bindings projects enumeration enhancements

The TransformsEnumFields.xml file in bindings projects nowallows <mapping> and <field> elements that use just clr-enum-type andclr-name attributes, with no jni-interface or jni-name attributes. Thisprovides additional flexibility to define custom C# enumerations that arevisible to the bindings generation process and do not correspond to any Javatype in the bound Java library. For example:

For enumerations that do correspond to Java types, project authors shouldcontinue to include the jni-interface and jni-name attributes as before.

XA0119 error for incompatible use of Android App Bundle format in Debug configuration

The Android App Bundle publishing format is not currently compatible with therecommended fast deployment settings for Debug configuration deployments.Previously, projects that had Android Package Format(AndroidPackageFormat) set to aab in the Debug configuration that also hadthe recommended Use Shared [Mono] Runtime setting enabled would produce abuild warning and then fail to launch on device.

Because this configuration is not currently supported, Xamarin.Android nowproduces an error for it instead of a warning:

To resolve this error, change the Android Package Format setting in theVisual Studio project property pages to apk for the Debug configuration.This corresponds to the apk value for the AndroidPackageFormat MSBuildproperty in the .csproj file:

This error is only relevant for Debug configuration builds. Releaseconfiguration builds can continue to use the Android App Bundle packagingformat.

AAPT2 version update to 4.0.0

The version of the Android Asset Packaging Tool AAPT2 included inXamarin.Android has been updated from 3.5.3 to 4.0.0.

Issues fixed in Xamarin.Android 11.0.0.3

Application behavior on device and emulator

  • Developer Community 970610,Java.Interop GitHub 661:System.TypeLoadException: 'Could not load type'Android.App.Application.IActivityLifecycleCallbacks' could cause apps usingthe Android 11 Developer Preview bindings toabort during startup.
  • Developer Community 1045818:Starting in Xamarin.Android 10.3 on Windows, errors similar toJava.Lang.RuntimeException: 'Font asset not found Fonts/fontello.ttf' couldcause apps to abort unexpectedly on device after they were updated andredeployed from Visual Studio on Windows.
  • Developer Community 1071004,GitHub 4795:Starting in Xamarin.Android 10.3, Unable to activate instance of typeAndroid.Util.SparseArray`1[E] could cause apps built in the Debugconfiguration to abort.
  • GitHub 4772,GitHub 4852:System.DllNotFoundException: libmono-native.so assembly:<unknown assembly>type:<unknown type> member:(null) could cause apps to abort during startupon certain Android 5.0 Lollipop (API level 21) and Android 5.1 Lollipop (APIlevel 22) devices.
  • GitHub 4791:Starting in Xamarin.Android 10.3, many typemap: module matching MVID [..]not found. messages were logged to the application output for certain runningapps, obscuring other logging statements of interest. These messages werediagnostic and did not indicate problems in the apps.
  • GitHub PR 4792:Starting in Xamarin.Android 10.4.0.0, F/monodroid-assembly(11348): Compressedassembly 'mscorlib.dll' is larger than when the application was built(expected at most 146432, got 2043392). Assemblies don't grow just like that!could appear in application logs in certain cases for apps using the newdefault managed assembly compression. The problem described by the messagecould result in other unexpected behaviors in the running app.
  • GitHub 4805:Starting in Xamarin.Android 10.3, localized resources from .resx files inXamarin.Android application projects were no longer deployed when building anddeploying from within Visual Studio to an attached device or emulator. (Incontrast, clean builds started on the command line worked as expected.)
  • GitHub 4809:Starting in Xamarin.Android 10.3, System.MemberAccessException: Cannot createan instance of .. could cause apps built in the Debug configuration to abortwhen attempting to use certain APIs involving types that have both generic andnon-generic versions such as Android.Widget.ArrayAdapter.
  • GitHub PR 4846:On Android 11 (API level 30) devices and emulators,java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider:java.lang.RuntimeException: Unable to find applicationMono.Android.Platform.ApiLevel_30! caused apps to abort during startup forprojects with the Target Android version set to API level 30 in theAndroid Manifest tab of the project property pages.

Application and library build and deployment

  • Developer Community 1061307Changes to files set to use the LinkDescription Build Action were notincluded as expected in incremental builds. Clean rebuilds were required topropagate the changes as expected.
  • Developer Community 1076396:DllImport error loading library '__Internal': 'Could not load library:Library '/system/lib64/libmonodroid.so' not found.' caused apps to abortduring startup when built in an unsupported Debug configuration, withAndroid Package Format set to aab, because the build only provided awarning. The build now produces an error instead.
  • GitHub 4790:Starting in Xamarin.Android 10.3, errors similar to error XA3006: Could notcompile native assembly file: typemaps.x86.s caused incremental builds tofail after changes to the Supported architectures (AndroidSupportedAbis)in the Advanced section of the Android Options tab in the projectproperty pages.
  • GitHub 4804:Starting in Xamarin.Android 10.3, Failed to parse APK info: failed to parseAndroidManifest.xml, error: %!s() prevented incremental deployments ofcertain projects that had references to libraries containingAndroidManifest.xml files.
  • GitHub 4853:Starting in Xamarin.Android 10.4.0.0, error XA0030: Building with JDK version`11.0.7` is not supported. prevented using the latest available OpenJDK 11version, such as the latest build of the JetBrains Runtime.
  • For Android 11 (API level 30) emulators, failed to installMono.Android.Platform.ApiLevel_30.apk:Failure[INSTALL_PARSE_FAILED_NO_CERTIFICATES: Scanning Failed.: No signature foundin package of version 2 or newer for packageMono.Android.Platform.ApiLevel_30] prevented deploying successfully in theDebug configuration with the shared runtime enabled, which is the recommendeddefault.

Application Mono Framework behavior on device and emulator

This version of Xamarin.Android updates theMono 6.12runtime and class libraries fromCommit 87ef5557toCommit 83105ba2,adding6 new commits.

Fixes included for issues reported with Xamarin.Android applications:

  • GitHub 4817:* Assertion at .. mono/mini/method-to-ir.c:12332, condition `var->opcode OP_REGOFFSET' not met caused apps to abort in the Release configurationwhen attempting to use the new() type constraint in combination with theXElement type.

Bindings projects

  • Java.Interop GitHub 515:Bindings projects did not yet have a convenient way to add C# enumerationsthat did not correspond to Java types.
  • Java.Interop GitHub 588:Warnings similar to warning BG8503: Invalidating Java.Util.IMap and allnested types because some of its methods were invalid. could prevent thebindings generator from providing bindings for interfaces even when theinvalid methods were all marked static. Because classes are not required toimplement static methods from Java interfaces, the bindings generator nowignores invalid static methods and continues generating bindings forinterfaces in these cases.
  • Java.Interop GitHub PR 651:Unactionable warning : class-parse: warning: method .. Local variables arrayhas 0 entries .. descriptor has 1 entries! prevented the bindings generatorfrom detecting parameter names for constructor methods marked with the Kotlin@JvmOverloads annotation.

June 23, 2020 — Xamarin.Android 10.4.0.0

This version is included in the Visual Studio 2019 version 16.7 Preview 3release and the Preview updater channel of Visual Studio 2019 for Mac version8.7 Preview 3.

In Xamarin.Android 10.4.0.0

Deprecations, removals, and default configuration changes

Build and deployment performance in Xamarin.Android 10.4.0.0

  • GitHub PR 4750:Skip checking for uses of AppDomain.CreateDomain() in assemblies provided byXamarin.Android. This reduced the time for the LinkAssembliesNoShrink fromabout 2.6 seconds to about 1.8 seconds for an initial clean build of smallXamarin.Forms test app.

Smaller app package sizes

Managed assemblies are now compressed by default for Release configurationbuilds, resulting in significantly smaller APK and Android App Bundle sizes.Assemblies are compressed with the LZ4 algorithm during builds and thendecompressed on device during app startup.

For a small example Xamarin.Forms application, this reduced the APK size fromabout 23 megabytes to about 17 megabytes while only increasing the time todisplay the first page of the app from about 780 milliseconds to about 790milliseconds.

If needed, the new behavior can be disabled for a particular project by openingthe project file in Visual Studio or another text editorand setting the AndroidEnableAssemblyCompression MSBuild property to falsein the .csproj file:

Note

This feature is intended to replace the older Bundle assemblies into nativecode Visual Studio Enterprise feature for purposes of app size savings. TheAndroidEnableAssemblyCompression property takes precedence if both featuresare enabled. Project authors who no longer need the Bundle assemblies intonative code feature can now disable it or remove the BundleAssembliesMSBuild property from the .csproj file:

Background information

For comparison, for the small test Xamarin.Forms application with all targetABIs enabled, the Bundle assemblies into native code feature increases theAPK size from about 23 megabytes to about 26 megabytes while increasing the timeto display the first page of the app from about 780 milliseconds to about 850milliseconds.

Mac Android Studio Sdk Location

If only one target ABI is enabled for the test application, such as arm64-v8a,the Bundle assemblies into native code feature decreases the APK size fromaround 16 megabytes to around 7.5 megabytes, while the new LZ4 approachdecreases the size to around 8 megabytes. Time to display the first page is thesame in this case as with all target ABIs enabled.

The number of target ABIs affects the size comparison because Bundleassemblies into native code uses a separate copy of the compressed assembliesfor each ABI, while the new LZ4 approach shares them across all target ABIs.

Minimum compatible Android version changed back to Android 4.4 KitKat (API level 19)

The minimum compatible Android version for Xamarin.Android apps has been changedback to Android Android 4.4 KitKat (API level 19) to align more closely with theXamarin.Forms supported platforms.

This reverts the change from the previous preview that updated the minimumcompatible version to Android 5.0 Lollipop.

Enumerations for new constants in Android 11 Developer Preview 4

The preview bindings for Android 11 Developer Preview4 now provide strongly typed enumerations fornew constants that are part of Android 11.

Preliminary Java JDK 11 compatibility

Xamarin.Android can now use Java JDK 11 to build libraries and applications.

JDK 11 is not yet installed or required by default for Xamarin.Android, but theapksigner tool in Android SDK Build-Tools version 30 does require JDK 11, soproject authors who are using the preview bindings for Android 11 DeveloperPreview 4 and want to experiment with setting the AndroidSdkBuildToolsVersionMSBuild property to version 30.0.0 will need to use JDK 11.

To do so:

  1. Install a distribution of JDK 11 version 11.0.4 or lower, such as JetBrainsRuntimejbrsdk build 520.13 or earlier.

  2. On Windows, open Tools > Options in Visual Studio, select the Xamarin >Android Settings node, and set Java Development Kit Location to theroot of the JDK 11 installation.

    On macOS, open Visual Studio > Preferences, select the Projects > SDKLocations > Android node, open the Locations tab, and set the JavaSDK (JDK) Location to the root of the JDK 11 installation.

    Alternatively, to configure the JDK path per project, open the project filein Visual Studio or another text editor and set theJavaSdkDirectory MSBuild property to the root of the JDK 11 installation.For example:

The error that appears when attempting to use Android SDK Build-Tools 30.0with Java JDK 8 is:

Known Issues

  • GitHub 4789:error XACLP7004: System.ArgumentException: Directory ..objDebugjavadocs..' does not appear to be an android doc referencedirectory. prevents using the JavaSourceJar Build Action in bindingsprojects.
  • GitHub 4853:error XA0030: Building with JDK version `11.0.7` is not supported.prevents using the latest available OpenJDK 11 version, such as the latestbuild of the JetBrains Runtime.

XA1023 warning for upcoming DX DEX compiler deprecation

Projects that have Dex compiler set to dx in the Visual Studio projectproperty pages will now get a build warning:

To resolve this warning, set the Dex compiler in the Visual Studio projectproperty pages to d8, or edit the project file in VisualStudio or another text editor and set the AndroidDexToolMSBuild property to d8:

Background information

Google has deprecated the DX DEX compiler in favor of the D8DEX compiler. After February 1, 2021, DX will no longer be a partof the Android SDK or Android Studio. Project authors are encouraged to migratetheir projects to D8 at their earliest convenience to prepare for this change.

Updated XA0113 warning for Google Play submission requirements

The XA0113 warning has been updated to reflect the current minimum targetversion of Android 9 (API level 28) for submissions to the GooglePlay store. The following warning will now appear for projects that have anearlier version set under Compile using Android version: (Target Framework)in the Visual Studio project property pages:

Mono.Data.Sqlite SQLite version update

The version of SQLite used by Mono.Data.Sqlite in Xamarin.Android has beenupdated from 3.31.1 to 3.32.1,bringing in security fixes, improvements, and bug fixes.

JI_JAVA_HOME environment variable for custom Java JDK paths

Xamarin.Android will now look for the contents of an environment variable namedJI_JAVA_HOME as another way to customize the Java JDK path used during thebuild. In cases where both the JI_JAVA_HOME environment variable and theJavaSdkDirectory MSBuild property are set to custom values, the MSBuildproperty takes precedence.

In general, this environment does not need to be adjusted, but in certainspecial scenarios, having the option to customize the JDK path via anenvironment variable might provide useful flexibility.

Issues fixed in Xamarin.Android 10.4.0.0

IDE compatibility

  • Developer Community 1038779:Starting in Visual Studio 2019 version 16.7 Preview 1, Visual Studio wouldabort unexpectedly when attempting to load or build certain Xamarin.Androidprojects configured to use AAPT2.

Application behavior on device and emulator

  • Developer Community 1021788,GitHub 4727:Many typemap: unable to find mapping to a Java type from managed typemessages were logged to the application output for running apps, in some casescausing Visual Studio to become unresponsive until the output window caughtup. This issue was also fixed in Xamarin.Android 10.3.1.4.
  • Developer Community 1030901,GitHub 4664:Localized resources from .resx files were not deployed when building anddeploying from within Visual Studio to an attached device or emulator. (Incontrast, clean builds on the command line worked as expected.) This issuewas also fixed in Xamarin.Android 10.3.1.4.

Application and library build and deployment

  • Developer Community 955972error APT2258: not well-formed (invalid token) prevented using accentedcharacters or other non-ASCII UTF-8 characters in Android layout files thatalso contained custom views. This issue was also fixed in Xamarin.Android10.3.1.4.
  • GitHub 4152:Unable to read profile .. The system cannot find the file specifiedprevented the FinishAotProfiling MSBuild target from completing successfullyif the location of adb was not in the PATH environment variable.
  • GitHub 4542:error CS1681: You cannot redefine the global extern alias prevented buildingapp projects successfully if the .csproj file included global in the<Aliases></Aliases> metadata element of a referenced Xamarin.Android classlibrary.
  • GitHub 4662:In projects configured to use the recently added manifestmerger.jar Androidmanifest merging option, tools:node='remove' did not yetremove AndroidManifest.xml nodes generated by C# attributes in referencedlibrary projects.
  • GitHub PR 4779:error XA1011: Using ProGuard with the D8 DEX compiler is no longer supported.Please update `$(AndroidLinkTool)` to `r8`. did not mention thecorresponding term code shrinker that is used in the Visual Studio projectproperty pages and did not mention that AndroidLinkTool is an MSBuildproperty.

Android API bindings

  • GitHub 4752:error XAGJS7004: System.ArgumentException: Unsupported ForegroundServiceTypevalue '9'. prevented using bitwise combinations of multiple values ofAndroid.Content.PM.ForegroundService.

Application Mono Framework behavior on device and emulator

This version of Xamarin.Android updates theMono 6.12runtime and class libraries fromCommit 075c3f06toCommit 87ef5557,adding5 new commits.

Mac Android Sdk Location

Fixes included for issues reported with Xamarin.Android applications:

  • GitHub 4713:Starting in Xamarin.Android 10.3, SIGSEGV duringmonodroid_typemap_java_to_managed could cause apps to abort if theapplication was built with the AndroidEnablePreloadAssemblies MSBuildproperty set to false.

June 2, 2020 — Xamarin.Android 10.3.99.259

This version is included in the Visual Studio 2019 version 16.7 Preview 2release and the Preview updater channel of Visual Studio 2019 for Mac version8.7 Preview 2.

In Xamarin.Android 10.3.99.259

Deprecations, removals, and default configuration changes

Minimum compatible Android version now Android 5.0 Lollipop (API level 21)

The minimum compatible Android version for Xamarin.Android apps is now Android5.0 Lollipop (API level 21).

Error XA0001 will now appear for projects that have an earlier target frameworkversion set under Compile using Android version: (Target Framework) in theVisual Studio project property pages:

Simiarly, warning XA4216 will now appear for projects that have an earlierversion set for the minSdkVersion in the AndroidManifest.xml file:

Background information

The unmanaged native libraries that are part of Xamarin.Android are now built totarget Android 5.0 Lollipop (API level 21), so apps built using this release canabort due to incompatible APIs if run on earlier Android versions.

Sync folders mac os x. Open /.bashprofile file or /.zshrc file and add the code below to them to add the environment variables.

Preview bindings for Android 11 Developer Preview 4

This version includes preview bindings for the fourth Developer Preview ofAndroid 11 from Google. See the Android 11 DeveloperPreview documentation for additional information about thebehavior and API changes in this new Android version. To try the bindings forthe new APIs in a Xamarin.Android project, set Compile using Android version:(Target Framework) to Android 10.0.99 (R) under the Application tab ofthe Visual Studio project property pages. This sets theTargetFrameworkVersion property to v10.0.99 in the .csproj file:

Bindings projects support for methods with more than 14 parameters

Xamarin.Android bindings projects now support binding Java methods that have anynumber of parameters instead of the previous limit of 14.

D8 and R8 version update to 1.6.82

The version of the D8 DEX compiler and R8 code shrinker included inXamarin.Android has been updated from 1.5.68 to 1.6.82.

bundletool version update to 0.14.0

The version of the bundletool executable included inXamarin.Android has been updated from 0.10.2 to 0.14.0,bringing in several improvements and bug fixes.

ProGuard version update to 6.2.2

The version of ProGuard included in Xamarin.Android has been updated from 5.3.2to 6.2.2, bringing in a number of improvements and bug fixes.

Note

ProGuard is only relevant for projects configured to use the older DX DEXcompiler. Project authors are recommended to update to the newer D8 DEXcompiler at their earliest convenience.

Issues fixed in Xamarin.Android 10.3.99.259

Application behavior on device and emulator

  • Developer Community 1024028,GitHub 4596,GitHub 4660:In Xamarin.Android 10.3.99.230, System.MemberAccessException: Cannot createan instance of .. could cause apps to abort when attempting to use certainAPIs that have both generic and non-generic versions.
  • GitHub 3784,GitHub 4471:An outdated version of the Mono Shared Runtime package was sometimes left ontarget development devices and emulators after Xamarin.Android versionupdates. This could result in unexpected behaviors in Debug configurationapps until the old shared runtime was manually uninstalled.
  • GitHub PR 4589:ObjectDisposedException could in theory be thrown during cancellation ofAndroidClientHandler requests, depending on the particular timing ofcancellation and object disposal. The time window where this can happen isnow narrower.

Application and library build and deployment

  • GitHub PR 4640:System.ArgumentException: Illegal characters in path could preventsuccessful automatic detection of the Android SDK location during builds insome cases if an AndroidSdkDirectory registry value was set forXamarin.Android that contained unexpected characters. One possible cause ofthis issue has now been addressed.

IDE compatibility

  • GitHub 4675:The project .. is missing Android SDKs required for building. preventedbuilding without the Android NDK installed for projects with Enable StartupTracing or AOT Compilation enabled.

Bindings projects

  • Java.Interop GitHub 631:Xamarin.Android bindings projects did not yet support binding Java methodswith more than 14 parameters.

May 19, 2020 — Xamarin.Android 10.3.99.230

This version is included in the Visual Studio 2019 version 16.7 Preview 1release and in the Preview updater channel of Visual Studio 2019 for Mac version 8.7 Preview 1.

In Xamarin.Android 10.3.99.230

Deprecations, removals, and default configuration changes

Build and deployment performance

  • GitHub PR 4190:Switch to running AAPT2 in single-file mode rather than --dir mode. Thisreduced the total incremental build time from about 16.4 seconds to about 5.5seconds for a test project when a single Android resource file was changedbetween builds.
  • Java.Interop GitHub PR 624,Java.Interop GitHub PR 627,Java.Interop GitHub PR 628:Update the CRC-64 algorithm used during builds to take advantage of a moreefficient calculation technique. This reduced the total incremental buildtime from about 8.7 seconds to about 8.5 seconds for a small Xamarin.Forms appwhen one line of a C# file was changed between builds.

Mono.Android nullable reference types compatibility

The Mono.Android assembly has been annotated for compatibility with C# 8.0nullable reference type checks. Projects can now optionally place codethat uses types from Mono.Android in a nullable context to take advantage ofadditional compiler nullability checks. For example, to enable nullabilitychecks for all code in a project, set the Nullable MSBuild property toenable in the .csproj file:

When this property set, the build will emit warnings if any code does notproperly account for possible null values passed into or returned from APIs inthe Mono.Android assembly.

See the nullable reference types documentation for more information.

Note

The majority of Mono.Android, including the nullability annotations, isautomatically generated from the Android Java source. The annotationsintentionally preserve any upstream bugs in the nullability informationprovided by the Android source code.

Tidier IntelliSense suggestions for Java.Lang.Object subclasses

Java.Lang.Object contains several properties and methods that are required tobe public to support Xamarin.Android Java bindings but are not intended to beused in hand-written code. These members are now hidden from IntelliSense,making it easier to find the useful members.

Bindings projects XA4231 and XA4232 warnings for deprecated settings

XA4231 warning for deprecated jar2xml parser

Any bindings project that has the AndroidClassParser MSBuild property set tothe old jar2xml parser or any other unrecognized value will now get a XA4231build warning:

To resolve this warning, update the Android Class Parser setting in theVisual Studio project property pages or the .jar file parser setting inVisual Studio for Mac to class-parse. This corresponds to the class-parsevalue for the AndroidClassParser MSBuild property in the .csproj file:

XA4232 warning for deprecated XamarinAndroid code generation target

Any bindings project that has the AndroidCodegenTarget MSBuild property set tothe old XamarinAndroid code generation target or any other unrecognized valuewill now get a XA4232 build warning:

To resolve this warning, update the Android Codegen target setting in theVisual Studio project property pages or the Code generation target settingin Visual Studio for Mac to XAJavaInterop1. This corresponds to theXAJavaInterop1 value for the AndroidCodegenTarget MSBuild property in the.csproj file:

Issues fixed in Xamarin.Android 10.3.99.230

Application and library build and deployment

  • GitHub 2042:The Mono.Android assembly did not yet surface the nullability informationprovided by the upstream Android source code for use in C# 8.0 nullablecontexts.
  • GitHub 4439:Invalid values of the AndroidDexTool MSBuild property produced a misleadingerror during deployment instead of an error during the build. Invalid valuesare now ignored and the default D8 DEX tool is used instead.
  • GitHub PR 4578:The source directory is under the output directory. Skip it. build error didnot yet mention the relevant MSBuild item type or the current path of theinvalid item.
  • Java.Interop GitHub PR 622:warning : Failed to read .. with debugging symbols. Retrying to load itwithout it. and Mono.Cecil.Cil.SymbolsNotMatchingException: Symbols werefound but are not matching the assembly could appear during builds, forexample for projects using obfuscation tools. To align more closely with thebehavior of other common .NET project types that do not warn about mismatcheddebugger symbols, Xamarin.Android projects now log these as informationalmessages instead of warnings.

Design-time builds

  • Developer Community 896179,GitHub 4273:The IDE could become unresponsive for tens of seconds after changes were savedto an Android layout file in projects configured to use AAPT2.

Bindings projects

  • GitHub PR 4579:Unrecognized transform root element build error did not yet mention therelevant MSBuild item type.
  • GitHub PR 4579:Specified source jar not found and Specified reference jar not found builderrors did not yet mention Java library types other than JAR files.
  • Java.Interop GitHub PR 611:Building a binding project that had a reference to another binding projectperformed some redundant work for assemblies referenced by both projects.

Application Mono Framework behavior on device and emulator

This version of Xamarin.Android updates theMono 6.12runtime and class libraries fromCommit 165f4b03toCommit 051408e0,adding5 new commits.

Fixes included for issues reported with Xamarin.Android applications:

  • Developer Community 952568,Mono GitHub 18865: Starting inXamarin.Android 10.2, SslStream.BeginRead() and SslStream.BeginWrite()would block if called at the same time.

IDE compatibility

  • GitHub 4582:Some Java.Lang.Object properties and methods like Handle andPeerReference appeared in IntelliSense suggestions even though they wereprimarily intended for use only in generated code.

Known issues in Xamarin.Android 10.3.99.230

Android Sdk Installation Location Windows

Application and library build and deployment

  • Developer Community 955972error APT2258: not well-formed (invalid token) prevents using accentedcharacters or other non-ASCII UTF-8 characters in Android layout files thatalso contain custom views.
  • Developer Community 955972Errors similar to error XARLC7000: System.Xml.XmlException: Invalid characterin the given encoding can prevent successful builds for certain projectconfigurations, such as projects located in directory paths that containaccented characters or other non-ASCII UTF-8 characters.

Application behavior on device and emulator

  • Developer Community 1024028,GitHub 4596,GitHub 4660:System.MemberAccessException: Cannot create an instance of .. can causeapps to abort when attempting to use certain APIs that have both generic andnon-generic versions. This issue will be resolved in a future previewversion.
  • Developer Community 1021788:GitHub 4727:Many typemap: unable to find mapping to a Java type from managed typemessages are logged to the application output for running apps, in some casescausing Visual Studio to become unresponsive until the output window catchesup.
  • Developer Community 1030901,GitHub 4664:Localized resources from .resx files are not deployed when building anddeploying from within Visual Studio to an attached device or emulator. (Incontrast, clean builds on the command line work as expected.)

Thank you

Mac Android Sdk Path

A big Thank You! to community members who contributed improvements in thisrelease:

  • Andrey Kurdyumov (@kant2002),GitHub PR 4275:Add compatibility with using a custom value in the NUGET_PACKAGESenvironment variable when building xamarin-android from source.
  • Andrey Kurdyumov (@kant2002),GitHub PR 4289:Update the instructions for building the Xamarin.Android-Tests.sln solutionin xamarin-android source checkouts on Windows.
  • Andrey Kurdyumov (@kant2002),GitHub PR 4332:Fix GitHub 4306 sothat xabuild can successfully build the Xamarin.Android-Tests.sln solutionmore than once in xamarin-android source checkouts.
  • Janus Weil (@janusw),GitHub PR 4346:Update the xamarin-android source build dependencies documentation for Linux.
  • Kyle Seongwoo Jun (@kyle-seongwoo-jun),GitHub PR 4525:Mention the .aab file format in addition to the .apk file format inXamarin.Android's draft document about .NET 5.

Feedback

Your feedback is important to us. If there are any problems with this release, check ourGitHub Issues,Xamarin.Android Community Forums andVisual Studio Developer Communityfor existing issues. For new issues within the Xamarin.Android SDK, please report aGitHub Issue.For general Xamarin.Android experience issues, let us know via theReport a Problemoption found in your favorite IDE under Help > Report a Problem.

Open source

Xamarin.Android 11.0 is based on the open-source Xamarin.Android repositories:

Android Sdk Location Windows 10

  • Core JNI interaction logic is in the Java.Interop repo.
  • Android bindings and MSBuild tooling are in the xamarin-android repo.
  • Chat is in the xamarin/xamarin-android Gitter channel.