配置AndroidStudio:IDE和VM选项,JDK,等等

Configuring Android Studio: IDE & VM Options, JDK, etc

【2016年6月22日 星期三】

原文地址:
Configuring Android Studio: IDE & VM Options, JDK, etc - Android Studio Project Site  
http://tools.android.com/tech-docs/configuration

-----分割线--------

你不应该在IDE安装目录编辑任何文件
相反,您可以通过 在以下目录创建 自己.properties.vmoptions  文件来修改属性。
 (This has been possible on some platforms before, but it required you to copy and change the entire contents of the files. 
With the latest changes these properties are now additive instead such that you can set just the attributes you care about, 
and the rest will use the defaults from the IDE installation).
(这是可能在一些平台上,但它需要你复制和改变文件的全部内容。
最新的更改这些属性现在添加剂代替,这样你可以设置属性你关心,
和其他IDE安装将使用默认值

Note: As of Android Studio 2.0, you can create/edit this file by accessing the "Edit Custom VM Options" file from the Help menu. 

Note: The folder name depends on the version of Android Studio. The documentation below applies to the release version (1.1.x), but if you are on a different version of Android Studio, see the table below for the correct folder name for your version.
The following table shows the configuration folder name to use for each studio version. This folder is referenced below as {FOLDER_NAME}

 Android Studio Version
 Preferences Folder Name
 1.0.x and 1.1.x AndroidStudio
 1.2.0 EAP/Preview AndroidStudioPreview1.2
 1.2.0, 1.2.1, 1.2.2 AndroidStudio1.2
 1.3 Preview AndroidStudioPreview1.3
 1.3.0, 1.3.1, 1.3.2 AndroidStudio1.3
1.4.0 Preview   AndroidStudioPreview1.4
1.4.0     AndroidStudio1.4
 1.5.0, 1.5.1 AndroidStudio1.5
 2.0 Preview, Beta AndroidStudioPreview2.0    
 2.0 AndroidStudio2.0
 2.1 Preview AndroidStudioPreview2.1
 2.1  AndroidStudio2.1
 2.2 Preview (Future) AndroidStudioPreview2.2

Windows:
  • %USERPROFILE%\.{FOLDER_NAME}\studio.exe.vmoptions and/or %USERPROFILE%\.{FOLDER_NAME}\studio64.exe.vmoptions
  • %USERPROFILE%\.{FOLDER_NAME}\idea.properties
Mac:
  • ~/Library/Preferences/{FOLDER_NAME}/studio.vmoptions
  • ~/Library/Preferences/{FOLDER_NAME}/idea.properties
Linux:
  • ~/.{FOLDER_NAME}/studio.vmoptions and/or ~/.{FOLDER_NAME}/studio64.vmoptions
  • ~/.{FOLDER_NAME}/idea.properties
You can also place use environment variables to point to specific override files elsewhere:
  • STUDIO_VM_OPTIONS, which vmoptions file to use
  • STUDIO_PROPERTIES, which property file to use
  • STUDIO_JDK, which JDK to run studio with
Note that this last variable allows you to for example run Android Studio with Java 7 on OSX (which normally picks Java 6 from the version specified in  Info.plist):
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk
$ open /Applications/Android\ Studio.app

(For Mac in particular, see this document on the topic of JDK selection.)

Increasing IDE Memory

By default, the IDE is assigned a maximum of 750 MB. If you have a large project, or if you have a lot of RAM on your system, the IDE will run better if you increase the amount of memory it is allowed to use. To do that, create your own studio.vmoptionsoverride (in the location explained above) and add a line like this:

-Xmx2048m

The full set of default JVM arguments are the following, in case you want to override any of the others (such as the start heap size of the MaxPermSize) :defaults in the IDE right 

-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCompressedOops

Setting a Property

If you want to override an IDE property, create a new idea.properties file in your local config directory, where you specify just the override properties. This file will be merged with the default properties in the IDE. See the below list for various properties you can change.

For example, Android Studio 2.0 ships with experimental improved bidirectional text support (issue  182739). To enable this support, create a file named  idea.properties with just this content:
editor.new.rendering=true

On a Mac, for Android Studio 2.0 Preview, copy this file to  ~/Library/Preferences/AndroidStudioPreview2.0/idea.properties
On Windows, the path would be  %USERPROFILE%\.AndroidStudioPreview2.0\idea.properties
On Linux, the path would be ~/.AndroidStudioPreview2.0/idea.properties

Help, I Already Edited the IDE Installation Files

If you've already edited the files by hand, here are the files from 1.0 such that you can restore them:

Android Studio is Ignoring My idea.vmoptions File

Around 1.0 we switched from storing VM options in a file called  idea.vmoptions to one called  studio.vmoptions, to avoid clashing with IntelliJ installations. If you had created a file named  idea.vmoptions for Studio, it will be ignored now. Put your edits in studio.vmoptions instead.

Properties

Here are properties you can customize in your own idea.properties file:

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.plugins.path=${idea.config.path}/plugins

#---------------------------------------------------------------------
# Maximum file size (kilobytes) IDE should provide code assistance for.
# The larger file is the slower its editor works and higher overall system memory requirements are
# if code assistance is enabled. Remove this property or set to very large number if you need
# code assistance for any files available regardless their size.
#---------------------------------------------------------------------
idea.max.intellisense.filesize=2500

#---------------------------------------------------------------------
# This option controls console cyclic buffer: keeps the console output size not higher than the specified buffer size (Kb).
# Older lines are deleted. In order to disable cycle buffer use idea.cycle.buffer.size=disabled
#---------------------------------------------------------------------
idea.cycle.buffer.size=1024

#---------------------------------------------------------------------
# Configure if a special launcher should be used when running processes from within IDE.
# Using Launcher enables "soft exit" and "thread dump" features
#---------------------------------------------------------------------
idea.no.launcher=false

#---------------------------------------------------------------------
# To avoid too long classpath
#---------------------------------------------------------------------
idea.dynamic.classpath=false

#---------------------------------------------------------------------
# There are two possible values of idea.popup.weight property: "heavy" and "medium".
# If you have WM configured as "Focus follows mouse with Auto Raise" then you have to
# set this property to "medium". It prevents problems with popup menus on some
# configurations.
#---------------------------------------------------------------------
idea.popup.weight=heavy

#---------------------------------------------------------------------
# Use default anti-aliasing in system, i.e. override value of "Settings|Editor|Appearance|Use anti-aliased font"
# option. May be useful when using Windows Remote Desktop Connection for instance.
#---------------------------------------------------------------------
idea.use.default.antialiasing.in.editor=false

#---------------------------------------------------------------------
# Disabling this property may lead to visual glitches like blinking and fail to repaint
# on certain display adapter cards.
#---------------------------------------------------------------------
sun.java2d.noddraw=true

#---------------------------------------------------------------------
# Removing this property may lead to editor performance degradation under Windows.
#---------------------------------------------------------------------
sun.java2d.d3d=false

#---------------------------------------------------------------------
# Workaround for slow scrolling in JDK6
#---------------------------------------------------------------------
swing.bufferPerWindow=false

#---------------------------------------------------------------------
# Removing this property may lead to editor performance degradation under X Window.
#---------------------------------------------------------------------
sun.java2d.pmoffscreen=false

#---------------------------------------------------------------------
# Workaround to avoid long hangs while accessing clipboard under Mac OS X.
#---------------------------------------------------------------------
#ide.mac.useNativeClipboard=True

#---------------------------------------------------------------------
# Maximum size (kilobytes) IDEA will load for showing past file contents -
# in Show Diff or when calculating Digest Diff
#---------------------------------------------------------------------
#idea.max.vcs.loaded.size.kb=20480

# ---------------------------------------------------------------------
# High Density (aka Retina aka HiDPI) Display support:
#
# The two options below allow overriding the built-in HiDPI display detection
# algorithm to provide a custom system DPI.
# The options are not supported on Mac, as Retina support is built-in.
#
# hidpi.system.dpi.override=<dpi_value>
# where <dpi_value> can range from 96 (100% zoom), to 288 (300%) zoom. 
#
# hidpi=true is a legacy option that is equivalent to setting
hidpi.system.dpi.override=192 (200% zoom)
# ---------------------------------------------------------------------
#hidpi.system.dpi.override=192
#hidpi=true
  • 6
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 我明白您的问题。在Android Studio中设置阈值的具体步骤取决于您要设置阈值的功能和工具。通常,您需要在代码中指定阈值,或使用Android Studio的一些工具来设置阈值。有些常见的设置阈值的方法可以是在代码中设置动态或静态阈值,或者在应用程序的配置文件中设置默认值。具体取决于您的具体需求和应用程序的功能。如果您需要更详细的帮助,请提供更多上下文和详细信息,这样我才能更好地为您提供帮助。 ### 回答2: 在Android Studio中设置阈值是通过调整代码中的特定参数来实现的。具体的设置方法如下: 1. 打开Android Studio并打开你的项目。 2. 导航到你想要设置阈值的代码文件。 3. 到要设置阈值的部分代码块。 4. 根据具体的需求,选择合适的阈值参数。例如,如果你想要设置一个时间阈值,你可以选择一个特定的时间长度作为阈值。 5. 在代码中到相应的参数位置,这通常是一个常量或变量。 6. 修改参数的值,将其设置为你想要的阈值。确保设置的值在逻辑和业务需求上是合理的。 7. 保存代码文件并重新编译你的项目。 8. 运行你的应用程序并测试设置的阈值是否符合预期。 需要注意的是,具体的设置方法和参数位置会根据你的项目和代码的结构而有所不同。在设置阈值时,你应该仔细阅读代码并理解每个参数的含义和作用,以便正确地设置阈值。此外,根据开发需求,你还可以通过在代码中添加条件语句来动态地调整阈值,以实现更灵活的设置。 ### 回答3: 在Android Studio中设置阈值是一种用来控制某种行为或条件的上限或下限值。它可以帮助我们根据需要进行筛选或限制。 在Android Studio中,我们可以设置各种不同类型的阈值,比如内存阈值、CPU阈值等。下面我将以内存阈值为例来说明在Android Studio中如何设置阈值。 首先,我们需要打开Android Studio,并打开我们想要设置阈值的项目。 然后,我们点击工具栏上的“Run”按钮,选择“Edit Configurations”选项。 在弹出的窗口中,我们可以看到左侧是项目的运行配置项。选择我们想要设置的运行配置项,比如“app”。 在右侧的选项卡中,我们可以到“Miscellaneous”选项。点击展开,我们可以看到“VM options”输入框。 在“VM options”输入框中,我们可以输入我们想要的阈值设定,比如“-Xmx512m”表示设置最大可用内存为512MB。 设置完阈值后,我们点击右下角的“Apply”和“OK”按钮保存我们的设置。 最后,我们重新运行我们的项目,Android Studio会根据我们设置的阈值来运行我们的应用程序。 这样,当我们的应用程序超过了我们设置的阈值,就会触发相应的行为或限制。 总的来说,在Android Studio中设置阈值是一种方便的方式来控制我们的应用程序的行为和性能。我们可以根据实际需求,灵活设置不同的阈值来满足我们的要求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值