Jaa


Adjusting Java memory parameters for the Android designer

The default memory parameters that are used when starting the java process for the Android designer might be incompatible with some system configurations.

Starting with Xamarin Studio 5.7.2.7 (and later, Visual Studio for Mac) and Visual Studio Tools for Xamarin 3.9.344, these settings can be customized on a per-project basis.

New Android designer properties and corresponding Java options

The following property names correspond to the indicated java command-line option

  • AndroidDesignerJavaRendererMinMemory -Xms

  • AndroidDesignerJavaRendererMaxMemory -Xmx

  • AndroidDesignerJavaRendererPermSize -XX:MaxPermSize

  1. Open your solution in Visual Studio.

  2. Select each Android project one-by-one in the Solution Explorer and click Show All Files twice on each project. You can skip projects that do not contain any .axml layout files. This step will ensure that each project directory contains a .csproj.user file.

  3. Quit Visual Studio.

  4. Locate the .csproj.user file for each of the projects from step 2.

  5. Edit each .csproj.user file in a text editor.

  6. Add any or all of the new Android designer memory properties within a <PropertyGroup> element. You can use an existing <PropertyGroup> or create a new one. Here's a complete example .csproj.user file that includes all 3 attributes set to their default values:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
       <PropertyGroup>
         <ProjectView>ProjectFiles</ProjectView>
       </PropertyGroup>
       <PropertyGroup>
         <AndroidDesignerJavaRendererMinMemory>128m</AndroidDesignerJavaRendererMinMemory>
         <AndroidDesignerJavaRendererMaxMemory>750m</AndroidDesignerJavaRendererMaxMemory>
         <AndroidDesignerJavaRendererPermSize>350m</AndroidDesignerJavaRendererPermSize>
       </PropertyGroup>
    </Project>
    
  7. Save and close all of the updated .csproj.user files.

  8. Restart Visual Studio and reopen your solution.