Merge "Merge commit '88c0af88' into mnc-dev..." into mnc-dev
This commit is contained in:
BIN
docs/html/images/tools/studio-globe-icon.png
Normal file
BIN
docs/html/images/tools/studio-globe-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 710 B |
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB |
@@ -4,9 +4,16 @@ page.title=Android Studio Tips and Tricks
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
<h2>In this document</h2>
|
||||
<ol>
|
||||
<li><a href="#productivity-features">Productivity Shortcuts</a></li>
|
||||
<li><a href="#intellij">Working with IntelliJ</a></li>
|
||||
<li><a href="#key-commands">Key Commands</a></li>
|
||||
</ol>
|
||||
|
||||
<h2>See also</h2>
|
||||
<ol>
|
||||
<li><a href="{@docRoot}tools/sdk/index.html">Download Android Studio</a></li>
|
||||
<li><a href="{@docRoot}sdk/index.html">Download Android Studio</a></li>
|
||||
<li><a href="http://wiki.jetbrains.net/intellij/Android">IntelliJ IDEA Android Tutorials</a></li>
|
||||
<li><a href="http://confluence.jetbrains.com/display/IntelliJIDEA/FAQ+on+Migrating+to+IntelliJ+IDEA">IntelliJ FAQ on migrating to IntelliJ IDEA</a></li>
|
||||
</ol>
|
||||
@@ -19,170 +26,178 @@ provides some tips to help you get started with some of the most common tasks an
|
||||
enhancements. </p>
|
||||
|
||||
|
||||
<h2>Smart Rendering</h2>
|
||||
<p>With smart rendering, Android Studio displays links for quick fixes to rendering errors.
|
||||
For example, if you add a button to the layout without specifying the <em>width</em> and
|
||||
<em>height</em> attributes, Android Studio displays the rendering message <em>Automatically
|
||||
add all missing attributes</em>. Clicking the message adds the missing attributes to the layout.</p>
|
||||
<h2 id="productivity-features">Productivity Shortcuts</h2>
|
||||
|
||||
<p>Android Studio includes a number of features to help you be more productive in your coding.
|
||||
This section notes a few of the key features to help you work quickly and efficiently.
|
||||
</p>
|
||||
|
||||
|
||||
<h2> Bitmap rendering in the debugger</h2>
|
||||
<p>While debugging, you can now right-click on bitmap variables in your app and invoke
|
||||
<em>View Bitmap</em>. This fetches the associated data from the debugged process and renders
|
||||
the bitmap in the debugger. </p>
|
||||
<p><img src="{@docRoot}images/tools/studio-bitmap-rendering.png" style="width:350px"/></p>
|
||||
<p class="img-caption"><strong>Figure 13.</strong> Bitmap Rendering/p>
|
||||
<h3>Smart Rendering</h3>
|
||||
<p>With smart rendering, Android Studio displays links for quick fixes to rendering errors.
|
||||
For example, if you add a button to the layout without specifying the <em>width</em> and
|
||||
<em>height</em> attributes, Android Studio displays the rendering message <em>Automatically
|
||||
add all missing attributes</em>. Clicking the message adds the missing attributes to the layout.</p>
|
||||
|
||||
|
||||
<h2>Output window message filtering</h2>
|
||||
<p>When checking build results, you can filter messages by <em>message type</em> to quickly
|
||||
locate messages of interest.</p>
|
||||
<img src="{@docRoot}images/tools/studio-outputwindowmsgfiltering.png" style="width:200px"style="width:200px" />
|
||||
<p class="img-caption"><strong>Figure 14.</strong> Filter Build Messages</p>
|
||||
<h3> Bitmap rendering in the debugger</h3>
|
||||
<p>While debugging, you can now right-click on bitmap variables in your app and invoke
|
||||
<em>View Bitmap</em>. This fetches the associated data from the debugged process and renders
|
||||
the bitmap in the debugger. </p>
|
||||
<p><img src="{@docRoot}images/tools/studio-bitmap-rendering.png" style="width:350px"/></p>
|
||||
<p class="img-caption"><strong>Figure 1.</strong> Bitmap Rendering</p>
|
||||
|
||||
|
||||
<h2>Hierarchical parent setting</h2>
|
||||
<p>The activity parent can now be set in the Activity Wizard when creating a new
|
||||
activity. Setting a <em>hierarchal parent</em> sets the {@code Up} button to automatically
|
||||
appear in the app's Action bar when viewing a child activity, so the {@code Up}
|
||||
button no longer needs to be manually specified in the <em>menu.xml</em> file.</p>
|
||||
<h3>Creating new files</h3>
|
||||
<p>You can quickly add new code and resource files by clicking the appropriate directory in the
|
||||
<strong>Project</strong> pane and pressing <code>ALT + INSERT</code> on Windows and Linux or
|
||||
<code>COMMAND + N</code> on Mac. Based on the type of directory selected, Android Studio
|
||||
offers to create the appropriate file type.</p>
|
||||
|
||||
<p>For example, if you select a layout directory, press <code>ALT + INSERT</code> on Windows,
|
||||
and select <strong>Layout resource file</strong>, a dialog opens so you can name the file
|
||||
(you can exclude the {@code .xml} suffix) and choose a root view element. The editor then
|
||||
switches to the layout design editor so you can begin designing your layout.</p>
|
||||
|
||||
|
||||
<h2>Creating layouts</h2>
|
||||
<p>Android Studio offers an advanced layout editor that allows you to drag-and-drop widgets
|
||||
into your layout and preview your layout while editing the XML.</p>
|
||||
|
||||
<p>While editing in the <strong>Text</strong> view, you can preview the layout on devices by
|
||||
opening the <strong>Preview</strong> pane available on the right side of the window. Within the
|
||||
Preview pane, you can modify the preview by changing various options at the top of the pane,
|
||||
including the preview device, layout theme, platform version and more. To preview the layout on
|
||||
multiple devices simultaneously, select <strong>Preview All Screen Sizes</strong> from the
|
||||
device drop-down.</p>
|
||||
<p><img src="{@docRoot}images/tools/studio-previewall.png" style="width:350px"/></p>
|
||||
<p class="img-caption"><strong>Figure 15.</strong> Preview All Screens/p>
|
||||
|
||||
<p>You can switch to the graphical editor by clicking <strong>Design</strong> at the
|
||||
bottom of the window. While editing in the Design view, you can show and hide the
|
||||
widgets available to drag-and-drop by clicking <strong>Palette</strong> on the left side of the
|
||||
window. Clicking <strong>Designer</strong> on the right side of the window reveals a panel
|
||||
with a layout hierarchy and a list of properties for each view in the layout.</p>
|
||||
<h3>Output window message filtering</h3>
|
||||
<p>When checking build results, you can filter messages by <em>message type</em> to quickly
|
||||
locate messages of interest.</p>
|
||||
<img src="{@docRoot}images/tools/studio-outputwindowmsgfiltering.png" style="width:200px"style="width:200px" />
|
||||
<p class="img-caption"><strong>Figure 2.</strong> Filter Build Messages</p>
|
||||
|
||||
|
||||
<h3>Annotations</h3>
|
||||
<p>Android Studio provides coding assistance for using annotations from the
|
||||
{@link android.support.annotation Support-Annotations} library, part of the
|
||||
Support Repository. Adding a dependency for this library enables you to decorate your code with
|
||||
annotations to help catch bugs, such as null pointer exceptions and resource type conflicts.
|
||||
You can also create enumerated annotations to, for example, check that a passed parameter value
|
||||
matches a value from a defined set of constants. For more information, see
|
||||
<a href="{@docRoot}tools/debugging/annotations.html#annotations">Improving Code Inspection with
|
||||
Annotations</a>. </p>
|
||||
<h3>Hierarchical parent setting</h3>
|
||||
<p>The activity parent can now be set in the Activity Wizard when creating a new
|
||||
activity. Setting a <em>hierarchal parent</em> sets the {@code Up} button to automatically
|
||||
appear in the app's Action bar when viewing a child activity, so the {@code Up}
|
||||
button no longer needs to be manually specified in the <em>menu.xml</em> file.</p>
|
||||
|
||||
|
||||
<h3>Java class decompiling</h3>
|
||||
<p>Android Studio allows you to look at what’s inside Java libraries when you don’t have access
|
||||
to the source code. </p>
|
||||
<h3>Creating layouts</h3>
|
||||
<p>Android Studio offers an advanced layout editor that allows you to drag-and-drop widgets
|
||||
into your layout and preview your layout while editing the XML.</p>
|
||||
|
||||
<p>The decompiler is built into Android Studio for easy access. To use this feature, right-click
|
||||
a class, method, or field from a library for which you do not have source file access and select
|
||||
<strong>decompile</strong>.</p> The decompiled source code appears. </p>
|
||||
<p>While editing in the <strong>Text</strong> view, you can preview the layout on devices by
|
||||
opening the <strong>Preview</strong> pane available on the right side of the window. Within the
|
||||
Preview pane, you can modify the preview by changing various options at the top of the pane,
|
||||
including the preview device, layout theme, platform version and more. To preview the layout on
|
||||
multiple devices simultaneously, select <strong>Preview All Screen Sizes</strong> from the
|
||||
device drop-down.</p>
|
||||
<p><img src="{@docRoot}images/tools/studio-previewall.png" style="width:350px"/></p>
|
||||
<p class="img-caption"><strong>Figure 3.</strong> Preview All Screens</p>
|
||||
|
||||
<p>To adjust the Java decompiler settings, select
|
||||
<strong>File > Settings > Other Settings > Java Decompiler</strong>. </p>
|
||||
<p>You can switch to the graphical editor by clicking <strong>Design</strong> at the
|
||||
bottom of the window. While editing in the Design view, you can show and hide the
|
||||
widgets available to drag-and-drop by clicking <strong>Palette</strong> on the left side of the
|
||||
window. Clicking <strong>Designer</strong> on the right side of the window reveals a panel
|
||||
with a layout hierarchy and a list of properties for each view in the layout.</p>
|
||||
|
||||
|
||||
<h3>Debugging and performance enhancements</h3>
|
||||
<p>Android Studio offers debugging and performance enhancements such as:</p>
|
||||
<ul>
|
||||
<li>Auto detect an expanded set of code styles. To modify the current code style, choose
|
||||
<strong>File > Settings > Code Styles</strong>. </li>
|
||||
<li>Support for high density (Retina) displays on Windows and Linux. </li>
|
||||
<li>Scratch files for quick prototyping without creating any project files.
|
||||
<p>Choose <strong>Tools > New Scratch File</strong> to open a scratch file to quickly
|
||||
build and run code prototypes. Together with Android Studio coding assistance, scratch
|
||||
files allow you to quickly run and debug code updates with the support of all file operations.
|
||||
By embedding code created with scripting languages, you can run your code from within the
|
||||
scratch file.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Annotations</h3>
|
||||
<p>Android Studio provides coding assistance for using annotations from the
|
||||
{@link android.support.annotation Support-Annotations} library, part of the
|
||||
Support Repository.
|
||||
|
||||
Adding a dependency for this library enables you to decorate your code with annotations to help
|
||||
catch bugs, such as null pointer exceptions and resource type conflicts. You can also create
|
||||
enumerated annotations to, for example, check that a passed parameter value matches a value from
|
||||
a defined set of constants. For more information, see
|
||||
<a href="{@docRoot}tools/debugging/annotations.html#annotations">Improving Code Inspection with
|
||||
Annotations</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<h3>Java class decompiling</h3>
|
||||
<p>Android Studio allows you to look at what’s inside Java libraries when you don’t have access
|
||||
to the source code. </p>
|
||||
|
||||
<p>The decompiler is built into Android Studio for easy access. To use this feature, right-click
|
||||
a class, method, or field from a library for which you do not have source file access and select
|
||||
<strong>decompile</strong>.</p> The decompiled source code appears. </p>
|
||||
|
||||
<p>To adjust the Java decompiler settings, select
|
||||
<strong>File > Settings > Other Settings > Java Decompiler</strong>. </p>
|
||||
|
||||
|
||||
<h3>Debugging and performance enhancements</h3>
|
||||
<p>Android Studio offers debugging and performance enhancements such as:</p>
|
||||
<ul>
|
||||
<li>Custom keymaps. To modify the current keymap, choose
|
||||
<strong>File > Settings > Keymap</strong>. </li>
|
||||
<li>Support for high density (Retina) displays on Windows and Linux. </li>
|
||||
<li>Scratch files for quick prototyping without creating any project files.
|
||||
<p>Choose <strong>Tools > New Scratch File</strong> to open a scratch file to quickly
|
||||
build and run code prototypes. Together with Android Studio coding assistance, scratch
|
||||
files allow you to quickly run and debug code updates with the support of all file operations.
|
||||
By embedding code created with scripting languages, you can run your code from within the
|
||||
scratch file.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h2 id="intellij">Working with IntelliJ-based Coding Practices</h2>
|
||||
<h2 id="intellij">Working with IntelliJ-based Coding Practices</h3>
|
||||
|
||||
<p>This section list just a few of the code editing
|
||||
practices you should consider using when creating Android Studio apps. </p>
|
||||
<p>This section list just a few of the code editing
|
||||
practices you should consider using when creating Android Studio apps. </p>
|
||||
|
||||
<p>For complete user documentation for the IntelliJ IDEA interface (upon which Android Studio
|
||||
is based), refer to the
|
||||
<a href="http://www.jetbrains.com/idea/documentation/index.jsp">IntelliJ IDEA documentation</a>.</p>
|
||||
|
||||
<h3><em>Alt + Enter</em> key binding</h3>
|
||||
<p>For quick fixes to coding errors, the IntelliJ powered IDE implements the <em>Alt + Enter</em>
|
||||
key binding to fix errors (missing imports, variable assignments, missing references, etc) when
|
||||
possible, and if not, suggest the most probable solution. </p>
|
||||
<p>For complete user documentation for the IntelliJ IDEA interface (upon which Android Studio
|
||||
is based), refer to the
|
||||
<a href="http://www.jetbrains.com/idea/documentation/index.jsp">IntelliJ IDEA documentation</a>.</p>
|
||||
|
||||
|
||||
<h3><em>Ctrl + D</em> key binding</h3>
|
||||
<p>The <em>Ctrl + D</em> key binding is great for quickly duplicating code lines or fragments.
|
||||
Simply select the desired line or fragment and enter this key binding. </p>
|
||||
|
||||
<h3>Navigate menu</h3>
|
||||
<p>In case you're not familiar with an API class, file or symbol, the <em>Navigate</em> menu lets
|
||||
you jump directly to the class of a method or field name without having to search through
|
||||
individual classes. </p>
|
||||
<h3><em>Alt + Enter</em> key binding</h3>
|
||||
<p>For quick fixes to coding errors, the IntelliJ powered IDE implements the <em>Alt + Enter</em>
|
||||
key binding to fix errors (missing imports, variable assignments, missing references, etc) when
|
||||
possible, and if not, suggest the most probable solution. </p>
|
||||
|
||||
|
||||
<h3>Inspection scopes</h3>
|
||||
<p>Scopes set the color of code segments for easy code identification and location. For example,
|
||||
you can set a scope to identify all code related to a specific action bar. </p>
|
||||
<h3><em>Ctrl + D</em> key binding</h3>
|
||||
<p>The <em>Ctrl + D</em> key binding is great for quickly duplicating code lines or fragments.
|
||||
Simply select the desired line or fragment and enter this key binding. </p>
|
||||
|
||||
|
||||
|
||||
<h3>External annotations</h3>
|
||||
<p>Specify annotations within the code or from an external annotation file. The Android Studio
|
||||
IDE keeps track of the restrictions and validates compliance, for example setting the data type
|
||||
of a string as not null.</p>
|
||||
<h3>Navigate menu</h3>
|
||||
<p>In case you're not familiar with an API class, file or symbol, the <em>Navigate</em> menu lets
|
||||
you jump directly to the class of a method or field name without having to search through
|
||||
individual classes. </p>
|
||||
|
||||
|
||||
<h3>Injecting languages</h3>
|
||||
<p>With language injection, the Android Studio IDE allows you to work with islands of different
|
||||
languages embedded in the source code. This extends the syntax, error highlighting and coding
|
||||
assistance to the embedded language. This can be especially useful for checking regular expression
|
||||
values inline, and validating XML and SQL statements.</p>
|
||||
|
||||
<h3>Code folding</h3>
|
||||
<p>This allows you to selectively hide and display sections of the code for readability. For
|
||||
example, resource expressions or code for a nested class can be folded or hidden in to one line
|
||||
to make the outer class structure easier to read. The inner class can be later expanded for
|
||||
updates. </p>
|
||||
<h3>Inspection scopes</h3>
|
||||
<p>Scopes set the color of code segments for easy code identification and location. For example,
|
||||
you can set a scope to identify all code related to a specific action bar. </p>
|
||||
|
||||
|
||||
<h3>Image and color preview</h3>
|
||||
<p>When referencing images and icons in your code, a preview of the image or icon appears
|
||||
(in actual size at different densities) in the code margin to help you verify the image or icon
|
||||
reference. Pressing {@code F1} with the preview image or icon selected displays resource asset
|
||||
details, such as the <em>dp</em> settings. </p>
|
||||
<h3>Injecting languages</h3>
|
||||
<p>With language injection, the Android Studio IDE allows you to work with islands of different
|
||||
languages embedded in the source code. This extends the syntax, error highlighting and coding
|
||||
assistance to the embedded language. This can be especially useful for checking regular expression
|
||||
values inline, and validating XML and SQL statements.</p>
|
||||
|
||||
|
||||
<h3>Quick F1 documentation</h3>
|
||||
<p>You can now inspect theme attributes using <strong>View > Quick Documentation</strong>
|
||||
(<strong>F1</strong>),
|
||||
see the theme inheritance hierarchy, and resolve values for the various attributes.</p>
|
||||
|
||||
<p>If you invoke <strong> View > Quick Documentation</strong> (usually bound to F1) on the theme
|
||||
attribute <em>?android:textAppearanceLarge</em>, you will see the theme inheritance hierarchy and
|
||||
resolved values for the various attributes that are pulled in.</p>
|
||||
<h3>Code folding</h3>
|
||||
<p>This allows you to selectively hide and display sections of the code for readability. For
|
||||
example, resource expressions or code for a nested class can be folded or hidden in to one line
|
||||
to make the outer class structure easier to read. The inner class can be later expanded for
|
||||
updates. </p>
|
||||
|
||||
|
||||
<h3>Image and color preview</h3>
|
||||
<p>When referencing images and icons in your code, a preview of the image or icon appears
|
||||
(in actual size at different densities) in the code margin to help you verify the image or icon
|
||||
reference. Pressing {@code F1} with the preview image or icon selected displays resource asset
|
||||
details, such as the <em>dp</em> settings. </p>
|
||||
|
||||
<h3>New Allocation Tracker integration in the Android/DDMS window</h3>
|
||||
<p>You can now inspect theme attributes using <strong> View > Quick Documentation
|
||||
</strong> <code>F1</code>, see the theme inheritance hierarchy, and resolved values for the
|
||||
various attributes.</p>
|
||||
<img src="{@docRoot}images/tools/studio-allocationtracker.png" style="width:300px" />
|
||||
<p class="img-caption"><strong>Figure 16</strong> Allocation Tracker</p>
|
||||
|
||||
<h3>Quick F1 documentation</h3>
|
||||
<p>You can now inspect theme attributes using <strong>View > Quick Documentation</strong>
|
||||
(<strong>F1</strong>),
|
||||
see the theme inheritance hierarchy, and resolve values for the various attributes.</p>
|
||||
|
||||
<p>If you invoke <strong> View > Quick Documentation</strong> (usually bound to F1) on the theme
|
||||
attribute <em>?android:textAppearanceLarge</em>, you will see the theme inheritance hierarchy and
|
||||
resolved values for the various attributes that are pulled in.</p>
|
||||
|
||||
|
||||
|
||||
@@ -288,13 +303,5 @@ using Mac OS X, update your keymap to use the Mac OS X 10.5+ version keymaps und
|
||||
</table>
|
||||
|
||||
<p>For a complete keymap reference guide, see the
|
||||
<a href="http://www.jetbrains.com/idea/documentation/index.jsp">IntelliJ IDEA</a> documentation.</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="http://www.jetbrains.com/idea/documentation/index.jsp">IntelliJ IDEA</a>
|
||||
documentation.</p>
|
||||
|
||||
@@ -198,6 +198,75 @@ settings from the Android SDK installation. Android Studio adds the module-speci
|
||||
<code>proguard-rules.pro</code> at the root of the module, where you can add custom ProGuard
|
||||
rules.</p>
|
||||
|
||||
|
||||
|
||||
<h3>Application ID for package identification </h3>
|
||||
<p>With the Android build system, the <em>applicationId</em> attribute is used to
|
||||
uniquely identify application packages for publishing. The application ID is set in the
|
||||
<em>android</em> section of the <code>build.gradle</code> file.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 19
|
||||
buildToolsVersion "19.1"
|
||||
|
||||
defaultConfig {
|
||||
<strong>applicationId "com.example.my.app"</strong>
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 19
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
...
|
||||
</pre>
|
||||
|
||||
<p class="note"><strong>Note:</strong> The <em>applicationId</em> is specified only in your
|
||||
{@code build.gradle} file, and not in the AndroidManifest.xml file.</p>
|
||||
|
||||
<p>When using build variants, the build system enables you to uniquely identify different
|
||||
packages for each product flavors and build types. The application ID in the build type is added as
|
||||
a suffix to those specified for the product flavors. </p>
|
||||
|
||||
<pre>
|
||||
productFlavors {
|
||||
pro {
|
||||
applicationId = "com.example.my.pkg.pro"
|
||||
}
|
||||
free {
|
||||
applicationId = "com.example.my.pkg.free"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
}
|
||||
}
|
||||
....
|
||||
</pre>
|
||||
|
||||
<p>The package name must still be specified in the manifest file. It is used in your source code
|
||||
to refer to your R class and to resolve any relative activity/service registrations. </p>
|
||||
|
||||
<pre>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<strong>package="com.example.app"</strong>>
|
||||
</pre>
|
||||
|
||||
<p class="note"><strong>Note:</strong> If you have multiple manifests (for example, a product
|
||||
flavor specific manifest and a build type manifest), the package name is optional in those manifests.
|
||||
If it is specified in those manifests, the package name must be identical to the package name
|
||||
specified in the manifest in the <code>src/main/</code> folder. </p>
|
||||
|
||||
<p>For more information about the build files and process, see
|
||||
<a href="{@docRoot}sdk/installing/studio-build.html">Build System Overview</a>.</p>
|
||||
|
||||
|
||||
|
||||
<h3 id="configureSigning">Configure signing settings</h3>
|
||||
|
||||
<p>The debug and the release versions of the app differ on whether the application can be
|
||||
|
||||
@@ -12,9 +12,6 @@ page.tags=studio,sdk,tools,firstapp
|
||||
<li><a href="#project-structure">Project and File Structure</a></li>
|
||||
<li><a href="#build-system">Android Build System</a></li>
|
||||
<li><a href="#debug-perf">Debug and Performance</a></li>
|
||||
<li><a href="#install-updates">Installation, Setup, and Update Management</a></li>
|
||||
<li><a href="#proxy">HTTP Proxy Settings</a></li>
|
||||
<li><a href="#other">Other Highlights</a></li>
|
||||
|
||||
|
||||
</ol>
|
||||
@@ -46,7 +43,6 @@ Android Studio offers:</p>
|
||||
<li>And much more</li>
|
||||
</ul>
|
||||
|
||||
<p><b><a href="{@docRoot}sdk/index.html">Download Android Studio now</a></b>. </p>
|
||||
|
||||
<p>If you're new to Android Studio or the IntelliJ IDEA interface, this
|
||||
page provides an introduction to some key Android
|
||||
@@ -104,6 +100,7 @@ representation. To switch to back to the segregated project view, select <strong
|
||||
from the <strong>Project</strong> drop-down. </p>
|
||||
|
||||
|
||||
|
||||
<h3 id="other-views">Other Android Studio views</h3>
|
||||
<p>When you use the <em>Project</em> view in Android Studio, you
|
||||
should notice that the project structure appears different than you may be used to in Eclipse. Each
|
||||
@@ -140,22 +137,7 @@ and <a href="{@docRoot}tools/projects/index.html">Managing Projects</a>.</p>
|
||||
|
||||
|
||||
|
||||
<h3>Creating new files</h3>
|
||||
<p>You can quickly add new code and resource files by clicking the appropriate directory in the
|
||||
<strong>Project</strong> pane and pressing <code>ALT + INSERT</code> on Windows and Linux or
|
||||
<code>COMMAND + N</code> on Mac. Based on the type of directory selected, Android Studio
|
||||
offers to create the appropriate file type.</p>
|
||||
|
||||
<p>For example, if you select a layout directory, press <code>ALT + INSERT</code> on Windows,
|
||||
and select <strong>Layout resource file</strong>, a dialog opens so you can name the file
|
||||
(you can exclude the {@code .xml} suffix) and choose a root view element. The editor then
|
||||
switches to the layout design editor so you can begin designing your layout.</p>
|
||||
|
||||
|
||||
|
||||
<h2 id="build-system">Android Build System</h2>
|
||||
|
||||
<h3>Android Build System</h3>
|
||||
<p>The Android build system is the toolkit you use to build, test, run and package
|
||||
your apps. This build system replaces the Ant system used with Eclipse ADT. It can run as an
|
||||
integrated tool from the Android Studio menu and independently from the command line. You can use
|
||||
@@ -175,76 +157,11 @@ To configure custom build settings in an Android Studio project, see
|
||||
<a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>.</p>
|
||||
|
||||
|
||||
<h3 id="app-id">Application ID for package identification </h3>
|
||||
<p>With the Android build system, the <em>applicationId</em> attribute is used to
|
||||
uniquely identify application packages for publishing. The application ID is set in the
|
||||
<em>android</em> section of the <code>build.gradle</code> file.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 19
|
||||
buildToolsVersion "19.1"
|
||||
|
||||
defaultConfig {
|
||||
<strong>applicationId "com.example.my.app"</strong>
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 19
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
...
|
||||
</pre>
|
||||
|
||||
<p class="note"><strong>Note:</strong> The <em>applicationId</em> is specified only in your
|
||||
{@code build.gradle} file, and not in the AndroidManifest.xml file.</p>
|
||||
|
||||
<p>When using build variants, the build system enables you to uniquely identify different
|
||||
packages for each product flavors and build types. The application ID in the build type is added as
|
||||
a suffix to those specified for the product flavors. </p>
|
||||
|
||||
<pre>
|
||||
productFlavors {
|
||||
pro {
|
||||
applicationId = "com.example.my.pkg.pro"
|
||||
}
|
||||
free {
|
||||
applicationId = "com.example.my.pkg.free"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
}
|
||||
}
|
||||
....
|
||||
</pre>
|
||||
|
||||
<p>The package name must still be specified in the manifest file. It is used in your source code
|
||||
to refer to your R class and to resolve any relative activity/service registrations. </p>
|
||||
|
||||
<pre>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<strong>package="com.example.app"</strong>
|
||||
</pre>
|
||||
|
||||
<p class="note"><strong>Note:</strong> If you have multiple manifests (for example, a product
|
||||
flavor specific manifest and a build type manifest), the package name is optional in those manifests.
|
||||
If it is specified in those manifests, the package name must be identical to the package name
|
||||
specified in the manifest in the <code>src/main/</code> folder. </p>
|
||||
|
||||
<p>For more information about the build files and process, see
|
||||
<a href="{@docRoot}sdk/installing/studio-build.html">Build System Overview</a>.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<h2 id="debug-perf">Debug and Performance</h2>
|
||||
|
||||
<p>Android Studio provides a number of improvements to assist you in debugging and improving the
|
||||
performance of your code, including an improved virtual device management, inline debugging, and
|
||||
performance analysis tools.</p>
|
||||
|
||||
<h3>Android Virtual Device (AVD) Manager</h3>
|
||||
<p>AVD Manager has updated screens with links to help you select the most popular device
|
||||
@@ -349,7 +266,8 @@ android {
|
||||
|
||||
|
||||
<p>You can also manage inspection profiles and configure inspections within Android Studio.
|
||||
Choose <strong>File > Settings > Project Settings</strong> and expand <strong>Editor</strong>.
|
||||
Choose <strong>File > Settings ></strong>, expand the <strong>Editor</strong> options,
|
||||
and select <strong>Inspections</strong>.
|
||||
The <em>Inspection Configuration</em> page appears with the supported inspections.</p>
|
||||
<p><img src="{@docRoot}images/tools/studio-inspections-config.png" alt="" /> </p>
|
||||
<p class="img-caption"><strong>Figure 5.</strong> Configure inspections.</p>
|
||||
@@ -505,7 +423,7 @@ the device display. </p>
|
||||
|
||||
<h3>Log messages</h3>
|
||||
<p>When you build and run your app with Android Studio, you can view adb and device log messages
|
||||
(logcat) in the DDMS pane by clicking <strong>Android</strong> at the bottom of the window.</p>
|
||||
(logcat) by clicking <strong>Android</strong> at the bottom of the window.</p>
|
||||
|
||||
<p>If you want to debug your app with the
|
||||
<a href="{@docRoot}tools/help/monitor.html">Android Debug Monitor</a>, you can launch it by
|
||||
@@ -519,231 +437,4 @@ controlling device behaviors, and more. It also includes the Hierarchy Viewer to
|
||||
|
||||
|
||||
|
||||
<h2 id="install-updates">Installation, Setup, and Update Management</h2>
|
||||
|
||||
<h3>Android Studio installation and setup wizards</h3>
|
||||
<p>When you begin the installation process, an installation and setup wizard walks you through
|
||||
a step-by-step installation and setup process as the wizard checks for system requirements,
|
||||
such as the Java Development Kit (JDK) and available RAM, and then prompts for optional
|
||||
installation options, such as the Intel® HAXM emulator accelerator.</p>
|
||||
|
||||
<p>During the installation process, a setup wizard walks you through the setup processes as
|
||||
the wizard updates your system image and emulation requirements, such GPU, and then creates
|
||||
an optimized default Android Virtual Device (AVD) based on Android 5 (Lollipop) for speedy and
|
||||
reliable emulation. </p>
|
||||
<p><img src="{@docRoot}images/tools/studio-setup-wizard.png" /></p>
|
||||
<p class="img-caption"><strong>Figure 9.</strong> Installation and setup wizard.</p>
|
||||
|
||||
|
||||
<h3>Expanded template and form factor support</h3>
|
||||
<p>Android Studio supports templates for Google Services and expands the available device
|
||||
types. </p>
|
||||
|
||||
<h4> Android Wear and TV support</h4>
|
||||
<p>For easy cross-platform development, the Project Wizard provides templates for
|
||||
creating your apps for Android Wear and TV. </p>
|
||||
<p><img src="{@docRoot}images/tools/studio-tvwearsupport.png" />
|
||||
|
||||
<p class="img-caption"><strong>Figure 10.</strong> Supported form factors.</p>
|
||||
<p>During app creation, the Project Wizard also displays an API Level dialog to help you choose
|
||||
the best <em>minSdkVersion</em> for your project.</p>
|
||||
|
||||
|
||||
<h4> Google App Engine integration (Google Cloud Platform/Messaging)</h4>
|
||||
<p>Quick cloud integration. Using Google App Engine to connect to the Google cloud
|
||||
and create a cloud end-point is as easy as selecting <em>File > New Module > App Engine Java
|
||||
Servlet Module</em> and specifying the module, package, and client names. </p>
|
||||
<p><img src="{@docRoot}images/tools/studio-cloudmodule.png" /></p>
|
||||
<p class="img-caption"><strong>Figure 11.</strong> Google App Engine integration.</p>
|
||||
|
||||
|
||||
<h3>Easy access to project and file settings</h3>
|
||||
<p>Android Studio provides setting dialogs so you can manage the most important project and file
|
||||
settings from the <strong>File</strong> menus as well as the build and configuration files. For
|
||||
example, you can use the <strong>File > Project Structure</strong> menu or
|
||||
the <code>build.gradle</code> file to update your <code>productFlavor</code> settings.
|
||||
Additional settings from the <strong>File</strong> menus include:
|
||||
<ul>
|
||||
<li>SDK and JDK location </li>
|
||||
<li>SDK version </li>
|
||||
<li>Gradle and Android Plugin for Gradle versions </li>
|
||||
<li>Build tools version </li>
|
||||
<li>Multidex setting</li>
|
||||
<li>Product flavors </li>
|
||||
<li>Build types </li>
|
||||
<li>Dependencies </li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h3>Update channels</h3>
|
||||
<p>Android Studio provides four update channels to keep Android Studio up-to-date based on your
|
||||
code-level preference:
|
||||
<ul>
|
||||
<li><strong>Canary channel</strong>: Canary builds provide bleeding edge releases, updated
|
||||
about weekly. While these builds do get tested, they are still subject to bugs, as we want
|
||||
people to see what's new as soon as possible. This is not recommended for production.</li>
|
||||
<li><strong>Dev channel</strong>: Dev builds are hand-picked older canary builds that survived
|
||||
the test of time. They are updated roughly bi-weekly or monthly.</li>
|
||||
<li><strong>Beta channel</strong>: Beta builds are used for beta-quality releases before a
|
||||
production release.</li>
|
||||
<li><strong>Stable channel</strong>: Used for stable, production-ready versions.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>By default, Android Studio uses the <em>Stable</em> channel. Use
|
||||
<strong>File > Settings > Updates</strong> to change your channel setting. </p>
|
||||
|
||||
|
||||
|
||||
<h2 id="proxy">Proxy Settings</h2>
|
||||
<p>Proxies serve as intermediary connection points between HTTP clients and web servers that add
|
||||
security and privacy to internet connections.</p>
|
||||
|
||||
<p>To support running Android Studio behind a firewall, set the proxy settings for the
|
||||
Android Studio IDE and the SDK Manager. Use the Android Studio IDE HTTP Proxy settings page to set
|
||||
the HTTP proxy settings for Android Studio. The SDK Manager has a separate HTTP Proxy settings
|
||||
page.</p>
|
||||
|
||||
<p>When running the Android Plugin for Gradle from the command line or on machines where
|
||||
Android Studio is not installed, such as continuous integration servers, set the proxy settings
|
||||
in the Gradle build file.</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> After the initial installation of the Android Studio bundle,
|
||||
Android Studio can run with internet access or off-line. However, Android Studio requires an
|
||||
internet connection for Setup Wizard synchronization, 3rd-party library access, access to remote
|
||||
repositories, Gradle initialization and synchronization, and Android Studio version updates.</p>
|
||||
|
||||
|
||||
<h3>Setting up the Android Studio Proxy</h3>
|
||||
<p>Android Studio supports HTTP proxy settings so you can run Android Studio behind a firewall or
|
||||
secure network. To set the HTTP proxy settings in Android Studio:</p>
|
||||
<ol>
|
||||
<li>From the main menu choose <strong>File > Settings > Appearance & Behavior -- System
|
||||
Settings -- HTTP Proxy</strong>.
|
||||
|
||||
<li>In Android Studio, open the IDE Settings dialog.
|
||||
<ul>
|
||||
<li>On Windows and Linux, choose
|
||||
<strong>File > Settings > IDE Setting -- HTTP Proxy</strong>. </li>
|
||||
<li>On Mac, choose
|
||||
<strong>Android Studio > Preferences > IDE Setting -- HTTP Proxy</strong>. </li>
|
||||
</ul>
|
||||
The HTTP Proxy page appears.</li>
|
||||
<li>Select <strong>auto-detection</strong> to use an auto-configuration URL to configure the
|
||||
proxy settings or <strong>manual</strong> to enter each of the settings. For a detailed explanation
|
||||
of these settings, see
|
||||
<a href="https://www.jetbrains.com/idea/help/http-proxy.html">HTTP Proxy</a>. </li>
|
||||
<li>Click <strong>Apply</strong> to enable the proxy settings. </li>
|
||||
</ol>
|
||||
|
||||
<h3>Android Plugin for Gradle HTTP proxy settings</h3>
|
||||
When running the Android Plugin from the command line or on machines where Android Studio is not
|
||||
installed, set the Android Plugin for Gradle proxy settings in the Gradle build file.</p>
|
||||
|
||||
<p>For application-specific HTTP proxy settings, set the proxy settings in the
|
||||
{@code build.gradle} file as required for each application module.</p>
|
||||
<pre>
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
...
|
||||
|
||||
defaultConfig {
|
||||
...
|
||||
systemProp.http.proxyHost=proxy.company.com
|
||||
systemProp.http.proxyPort=443
|
||||
systemProp.http.proxyUser=userid
|
||||
systemProp.http.proxyPassword=password
|
||||
systemProp.http.auth.ntlm.domain=domain
|
||||
}
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
<p>For project-wide HTTP proxy settings, set the proxy settings in the
|
||||
<code>gradle/gradle.properties</code> file. </p>
|
||||
|
||||
<pre>
|
||||
# Project-wide Gradle settings.
|
||||
...
|
||||
|
||||
systemProp.http.proxyHost=proxy.company.com
|
||||
systemProp.http.proxyPort=443
|
||||
systemProp.http.proxyUser=username
|
||||
systemProp.http.proxyPassword=password
|
||||
systemProp.http.auth.ntlm.domain=domain
|
||||
|
||||
systemProp.https.proxyHost=proxy.company.com
|
||||
systemProp.https.proxyPort=443
|
||||
systemProp.https.proxyUser=username
|
||||
systemProp.https.proxyPassword=password
|
||||
systemProp.https.auth.ntlm.domain=domain
|
||||
|
||||
...
|
||||
</pre>
|
||||
|
||||
|
||||
<p>For information about using Gradle properties for proxy settings, see the
|
||||
<a href="http://www.gradle.org/docs/current/userguide/build_environment.html">Gradle User Guide</a>.</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> When using Android Studio, the settings in the Android
|
||||
Studio IDE HTTP proxy settings page override the HTTP proxy settings in the
|
||||
<strong>gradle.properties</strong> file.</p>
|
||||
|
||||
|
||||
|
||||
<h3>SDK Manager HTTP Proxy Settings </h3>
|
||||
<p>SDK Manager proxy settings enable proxy internet access for Android package and library
|
||||
updates from SDK Manager packages. </p>
|
||||
|
||||
<p>To set the SDK Manager settings for proxy internet access, start the SDK Manager and open the
|
||||
SDK Manager page. </p>
|
||||
|
||||
<ul>
|
||||
<li>On Windows, select <strong>Tools > Options</strong> from the menu bar. </li>
|
||||
<li>On Mac and Linux, choose <strong>Tools > Options</strong> from the system menu bar. </li>
|
||||
</ul>
|
||||
|
||||
<p>The Android SDK Manager page appears. Enter the settings and click <strong>Apply</strong>. </p>
|
||||
|
||||
|
||||
|
||||
<h2 id="other">Other Highlights</h2>
|
||||
|
||||
<h3 id="trans-editor"> Translations Editor</h3>
|
||||
<p>Multi-language support is enhanced with the Translations Editor plugin so you can easily add
|
||||
a variety of locales to the app's translation file. With
|
||||
<a href="https://tools.ietf.org/html/bcp47">BCP 47</a> support, the editor combines language and
|
||||
region codes into a single selection for targeted localizations. Color codes indicate whether a
|
||||
locale is complete or still missing string translations. </p>
|
||||
|
||||
<p>To access the Translations Editor, open a <code>strings.xml</code> file and click the
|
||||
<strong>Open Editor</strong> link. </p>
|
||||
|
||||
<img src="{@docRoot}images/tools/studio-translationeditoropen.png" />
|
||||
<p class="img-caption"><strong>Figure 12.</strong> Add locales and strings in the
|
||||
Translations Editor.</p>
|
||||
|
||||
|
||||
<h3> Editor support for the latest Android APIs</h3>
|
||||
<p>Android Studio supports the
|
||||
<a href="{@docRoot}design/material/index.html">Material Design</a></li> themes, widgets, and
|
||||
graphics, such as shadow layers and API version rendering (showing the layout across different
|
||||
UI versions). Also, the drawable XML tags and attributes, such as <code><ripple></code>
|
||||
and <code><animated-selector></code>, are supported.</p>
|
||||
|
||||
|
||||
<h3 id="git-samples"> Easy access to Android code samples on GitHub</h3>
|
||||
<p>Clicking <strong>Import Samples</strong> from the <strong>File</strong> menu or <em>Welcome</em>
|
||||
page provides seamless access to Google code samples on GitHub.</p>
|
||||
<p><img src="{@docRoot}images/tools/studio-samples-githubaccess.png" /></p>
|
||||
<p class="img-caption"><strong>Figure 13.</strong> Get code samples from GitHub.</p>
|
||||
|
||||
<p><img src="{@docRoot}images/tools/studio-sample-in-editor.png" /></p>
|
||||
<p class="img-caption"><strong>Figure 14.</strong> Imported code sample.</p>
|
||||
|
||||
|
||||
|
||||
174
docs/html/tools/studio/studio-config.jd
Normal file
174
docs/html/tools/studio/studio-config.jd
Normal file
@@ -0,0 +1,174 @@
|
||||
page.title=Configuration
|
||||
page.metaDescription=Learn about the Android Studio configuration.
|
||||
page.tags=studio, configuration
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
<h2>In this document</h2>
|
||||
<ol>
|
||||
<li><a href="#update-channel">Update Channels</a></li>
|
||||
<li><a href="#proxy">Proxy Settings</a></li>
|
||||
</ol>
|
||||
|
||||
<h2>See also</h2>
|
||||
<ol>
|
||||
<li><a href="{@docRoot}sdk/installing/index.html?pkg=studio">Installing Android Studio</a></li>
|
||||
<li><a href="{@docRoot}tools/workflow/index.html">Workflow</a></li>
|
||||
<li><a href="{@docRoot}sdk/installing/studio-features.html">Build System</a></li>
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p>During installation, Android Studio provides wizards and templates that verify your system
|
||||
requirements, such as the Java Development Kit (JDK) and available RAM, and configure default
|
||||
settings, such as an optimized default Android Virtual Device (AVD) emulation and updated system
|
||||
images. This document describes additional configuration settings you may want to use to
|
||||
customize your use of Android Studio. </p>
|
||||
|
||||
<p>For specific documentation about emulator and device setup and use, see
|
||||
<a href="{@docRoot}tools/devices/index.html">Managing Virtual Devices</a>,
|
||||
<a href="{@docRoot}tools/device.html">Using Hardware Devices</a>, and
|
||||
<a href="{@docRoot}tools/extras/oem-usb.html">OEM USB Drivers</a>. </p>
|
||||
|
||||
|
||||
|
||||
<h2 id="update-channel">Update channels</h2>
|
||||
<p>Android Studio provides four update channels to keep Android Studio up-to-date based on your
|
||||
code-level preference:
|
||||
<ul>
|
||||
<li><strong>Canary channel</strong>: Canary builds provide bleeding edge releases, updated
|
||||
about weekly. While these builds do get tested, they are still subject to bugs, as we want
|
||||
people to see what's new as soon as possible. This is not recommended for production.</li>
|
||||
<li><strong>Dev channel</strong>: Dev builds are hand-picked older canary builds that survived
|
||||
the test of time. They are updated roughly bi-weekly or monthly.</li>
|
||||
<li><strong>Beta channel</strong>: Beta builds are used for beta-quality releases before a
|
||||
production release.</li>
|
||||
<li><strong>Stable channel</strong>: Used for stable, production-ready versions.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>By default, Android Studio uses the <em>Stable</em> channel. Use
|
||||
<strong>File > Settings > Appearance & Behavior System Settings > Updates</strong> to change your
|
||||
channel setting. </p>
|
||||
|
||||
|
||||
|
||||
<h2 id="proxy">Proxy Settings</h2>
|
||||
<p>Proxies serve as intermediary connection points between HTTP clients and web servers that add
|
||||
security and privacy to internet connections.</p>
|
||||
|
||||
<p>To support running Android Studio behind a firewall, set the proxy settings for the
|
||||
Android Studio IDE and the SDK Manager. Use the Android Studio IDE HTTP Proxy settings page to set
|
||||
the HTTP proxy settings for Android Studio. The SDK Manager has a separate HTTP Proxy settings
|
||||
page.</p>
|
||||
|
||||
<p>When running the Android Plugin for Gradle from the command line or on machines where
|
||||
Android Studio is not installed, such as continuous integration servers, set the proxy settings
|
||||
in the Gradle build file.</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> After the initial installation of the Android Studio bundle,
|
||||
Android Studio can run with internet access or off-line. However, Android Studio requires an
|
||||
internet connection for Setup Wizard synchronization, 3rd-party library access, access to remote
|
||||
repositories, Gradle initialization and synchronization, and Android Studio version updates.</p>
|
||||
|
||||
|
||||
<h3>Setting up the Android Studio Proxy</h3>
|
||||
<p>Android Studio supports HTTP proxy settings so you can run Android Studio behind a firewall or
|
||||
secure network. To set the HTTP proxy settings in Android Studio:</p>
|
||||
<ol>
|
||||
<li>From the main menu choose <strong>File > Settings > Appearance & Behavior -- System
|
||||
Settings -- HTTP Proxy</strong>.
|
||||
|
||||
<li>In Android Studio, open the IDE Settings dialog.
|
||||
<ul>
|
||||
<li>On Windows and Linux, choose
|
||||
<strong>File > Settings > IDE Setting -- HTTP Proxy</strong>. </li>
|
||||
<li>On Mac, choose
|
||||
<strong>Android Studio > Preferences > IDE Setting -- HTTP Proxy</strong>. </li>
|
||||
</ul>
|
||||
The HTTP Proxy page appears.</li>
|
||||
<li>Select <strong>auto-detection</strong> to use an auto-configuration URL to configure the
|
||||
proxy settings or <strong>manual</strong> to enter each of the settings. For a detailed explanation
|
||||
of these settings, see
|
||||
<a href="https://www.jetbrains.com/idea/help/http-proxy.html">HTTP Proxy</a>. </li>
|
||||
<li>Click <strong>Apply</strong> to enable the proxy settings. </li>
|
||||
</ol>
|
||||
|
||||
<h3>Android Plugin for Gradle HTTP proxy settings</h3>
|
||||
When running the Android Plugin from the command line or on machines where Android Studio is not
|
||||
installed, set the Android Plugin for Gradle proxy settings in the Gradle build file.</p>
|
||||
|
||||
<p>For application-specific HTTP proxy settings, set the proxy settings in the
|
||||
{@code build.gradle} file as required for each application module.</p>
|
||||
<pre>
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
...
|
||||
|
||||
defaultConfig {
|
||||
...
|
||||
systemProp.http.proxyHost=proxy.company.com
|
||||
systemProp.http.proxyPort=443
|
||||
systemProp.http.proxyUser=userid
|
||||
systemProp.http.proxyPassword=password
|
||||
systemProp.http.auth.ntlm.domain=domain
|
||||
}
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
<p>For project-wide HTTP proxy settings, set the proxy settings in the
|
||||
<code>gradle/gradle.properties</code> file. </p>
|
||||
|
||||
<pre>
|
||||
# Project-wide Gradle settings.
|
||||
...
|
||||
|
||||
systemProp.http.proxyHost=proxy.company.com
|
||||
systemProp.http.proxyPort=443
|
||||
systemProp.http.proxyUser=username
|
||||
systemProp.http.proxyPassword=password
|
||||
systemProp.http.auth.ntlm.domain=domain
|
||||
|
||||
systemProp.https.proxyHost=proxy.company.com
|
||||
systemProp.https.proxyPort=443
|
||||
systemProp.https.proxyUser=username
|
||||
systemProp.https.proxyPassword=password
|
||||
systemProp.https.auth.ntlm.domain=domain
|
||||
|
||||
...
|
||||
</pre>
|
||||
|
||||
|
||||
<p>For information about using Gradle properties for proxy settings, see the
|
||||
<a href="http://www.gradle.org/docs/current/userguide/build_environment.html">Gradle User Guide</a>.</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> When using Android Studio, the settings in the Android
|
||||
Studio IDE HTTP proxy settings page override the HTTP proxy settings in the
|
||||
<strong>gradle.properties</strong> file.</p>
|
||||
|
||||
|
||||
|
||||
<h3>SDK Manager HTTP Proxy Settings </h3>
|
||||
<p>SDK Manager proxy settings enable proxy internet access for Android package and library
|
||||
updates from SDK Manager packages. </p>
|
||||
|
||||
<p>To set the SDK Manager settings for proxy internet access, start the SDK Manager and open the
|
||||
SDK Manager page. </p>
|
||||
|
||||
<ul>
|
||||
<li>On Windows, select <strong>Tools > Options</strong> from the menu bar. </li>
|
||||
<li>On Mac and Linux, choose <strong>Tools > Options</strong> from the system menu bar. </li>
|
||||
</ul>
|
||||
|
||||
<p>The Android SDK Manager page appears. Enter the settings and click <strong>Apply</strong>. </p>
|
||||
|
||||
|
||||
|
||||
123
docs/html/tools/studio/studio-features.jd
Normal file
123
docs/html/tools/studio/studio-features.jd
Normal file
@@ -0,0 +1,123 @@
|
||||
page.title=Features
|
||||
page.metaDescription=Learn about the Android Studio features.
|
||||
page.tags=studio, features
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
<h2>In this document</h2>
|
||||
<ol>
|
||||
<li><a href="#trans-editor">Translations Editor</a></li>
|
||||
<li><a href="#git-samples">Android Code Samples on GitHub</a></li>
|
||||
<li><a href="#template-support">Expanded Template and Form Factor Support</a></li>
|
||||
<li><a href="#project-settings">Android Studio and Project Settings</a></li>
|
||||
<li><a href="#support-apis">Editor Support for the Latest Android APIs</a></li>
|
||||
</ol>
|
||||
|
||||
<h2>See also</h2>
|
||||
<ol>
|
||||
<li><a href="{@docRoot}tools/workflow/index.html">Workflow</a></li>
|
||||
<li><a href="{@docRoot}sdk/installing/studio-build.html">Build System</a></li>
|
||||
<li><a href="{@docRoot}sdk/installing/studio-tips.html">Android Studio Tip & Tricks</a></li>
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p>If you're new to Android Studio or exploring recent updates, this
|
||||
page provides an introduction to some key Android Studio features.</p>
|
||||
|
||||
<p>For specific Android Studio how-to documentation, see the pages in the <a href=
|
||||
"{@docRoot}tools/workflow/index.html">Workflow</a> section, such as
|
||||
<a href="{@docRoot}sdk/installing/create-project.html">Managing Projects from Android Studio</a>
|
||||
and
|
||||
<a href="{@docRoot}tools/building/building-studio.html">Building and Running from Android Studio</a>. </p>
|
||||
|
||||
|
||||
|
||||
<h2 id="trans-editor">Translations Editor</h2>
|
||||
<p>Multi-language support is enhanced with the Translations Editor plugin so you can easily add
|
||||
a variety of locales to the app's translation file. With
|
||||
<a href="https://tools.ietf.org/html/bcp47">BCP 47</a> support, the editor combines language and
|
||||
region codes into a single selection for targeted localizations. Color codes indicate whether a
|
||||
locale is complete or still missing string translations. </p>
|
||||
|
||||
<p>To access the Translations Editor, open a <code>strings.xml</code> file and click the
|
||||
<strong>Open Editor</strong> link, or click the globe icon
|
||||
(<img src="{@docRoot}images/tools/studio-globe-icon.png" style="vertical-align:bottom;margin:0;height:19px" />) in the Design layout view. </p>
|
||||
|
||||
|
||||
<img src="{@docRoot}images/tools/studio-translationeditoropen.png" />
|
||||
<p class="img-caption"><strong>Figure 1.</strong> Add locales and strings in the
|
||||
Translations Editor.</p>
|
||||
|
||||
|
||||
|
||||
<h2 id="git-samples">Android Code Samples on GitHub</h2>
|
||||
<p>Clicking <strong>Import Samples</strong> from the <strong>File</strong> menu or <em>Welcome</em>
|
||||
page provides seamless access to Google code samples on GitHub.</p>
|
||||
<p><img src="{@docRoot}images/tools/studio-samples-githubaccess.png" /></p>
|
||||
<p class="img-caption"><strong>Figure 2.</strong> Get code samples from GitHub.</p>
|
||||
|
||||
|
||||
<p><img src="{@docRoot}images/tools/studio-sample-in-editor.png" /></p>
|
||||
<p class="img-caption"><strong>Figure 3.</strong> Imported code sample.</p>
|
||||
|
||||
|
||||
|
||||
<h2 id="template-support">Expanded Template and Form Factor Support</h2>
|
||||
<p>Android Studio supports templates for Google Services and expands the available device
|
||||
types. </p>
|
||||
|
||||
<h4> Android Wear and TV support</h4>
|
||||
<p>For easy cross-platform development, the Project Wizard provides templates for
|
||||
creating your apps for Android Wear and TV. </p>
|
||||
<p><img src="{@docRoot}images/tools/studio-tvwearsupport.png" />
|
||||
|
||||
<p class="img-caption"><strong>Figure 4.</strong> Supported form factors.</p>
|
||||
<p>During app creation, the Project Wizard also displays an API Level dialog to help you choose
|
||||
the best <em>minSdkVersion</em> for your project.</p>
|
||||
|
||||
|
||||
<h4> Google App Engine integration (Google Cloud Platform/Messaging)</h4>
|
||||
<p>Quick cloud integration. Using Google App Engine to connect to the Google cloud
|
||||
and create a cloud end-point is as easy as selecting <em>File > New Module > App Engine Java
|
||||
Servlet Module</em> and specifying the module, package, and client names. </p>
|
||||
<p><img src="{@docRoot}images/tools/studio-cloudmodule.png" /></p>
|
||||
<p class="img-caption"><strong>Figure 5</strong> Google App Engine integration.</p>
|
||||
|
||||
|
||||
<h2 id="project-settings">Android Studio and Project Settings</h2>
|
||||
<p>Android Studio provides setting dialogs so you can manage the most important Android Studio and
|
||||
project settings from the <strong>File > Project Structure</strong> and
|
||||
<strong>File > Settings</strong> menus. For example, you can use the
|
||||
<strong>File > Project Structure</strong> menu or
|
||||
the <code>build.gradle</code> file to update your <code>productFlavor</code> settings.
|
||||
Additional settings from the <strong>File > Project Structure</strong> menus include:
|
||||
<ul>
|
||||
<li>SDK and JDK location </li>
|
||||
<li>SDK version </li>
|
||||
<li>Gradle and Android Plugin for Gradle versions </li>
|
||||
<li>Build tools version </li>
|
||||
<li>Multidex setting</li>
|
||||
<li><code>buildTypes</code> </li>
|
||||
<li>Dependencies </li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>Use the <strong>File > Settings</strong> menu to modify the Android Studio or project
|
||||
behavior, such a UI themes, system settings, and version control. </p>
|
||||
|
||||
|
||||
|
||||
<h2 id="support-apis">Editor Support for the Latest Android APIs</h2>
|
||||
<p>Android Studio supports the
|
||||
<a href="{@docRoot}design/material/index.html">Material Design</a></li> themes, widgets, and
|
||||
graphics, such as shadow layers and API version rendering (showing the layout across different
|
||||
UI versions). Also, the drawable XML tags and attributes, such as <code><ripple></code>
|
||||
and <code><animated-selector></code>, are supported.</p>
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
<a href="<?cs var:toroot?>tools/studio/index.html">Android Studio</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>tools/studio/studio-config.html">
|
||||
Configuration</a></li>
|
||||
<li><a href="<?cs var:toroot ?>tools/studio/studio-features.html">
|
||||
Features</a></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/installing/studio-tips.html">
|
||||
Tips and Tricks</a></li>
|
||||
</ul>
|
||||
@@ -196,6 +200,68 @@ class="en">Tools Help</span></a></div>
|
||||
</ul>
|
||||
</li><!-- end of build system -->
|
||||
|
||||
|
||||
<!-- Performance Tools menu-->
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header">
|
||||
<a href="<?cs var:toroot ?>tools/performance/index.html">Peformance Tools</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/debug-gpu-overdraw/index.html">
|
||||
Overdraw Debugger</a>
|
||||
</li>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/profile-gpu-rendering/index.html">
|
||||
Rendering Profiler</a>
|
||||
</li>
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header">
|
||||
<a href="<?cs var:toroot ?>tools/performance/hierarchy-viewer/index.html">
|
||||
Hierarchy Viewer</a></div>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/hierarchy-viewer/setup.html"><span
|
||||
class="en">Setup</span></a>
|
||||
</li>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/hierarchy-viewer/profiling.html"><span
|
||||
class="en">Profiling</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header">
|
||||
<a href="<?cs var:toroot ?>tools/performance/comparison.html">
|
||||
Memory Profilers</a></div>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/memory-monitor/index.html"><span
|
||||
class="en">Memory Monitor</span></a>
|
||||
</li>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/heap-viewer/index.html"><span
|
||||
class="en">Heap Viewer</span></a>
|
||||
</li>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/allocation-tracker/index.html"><span
|
||||
class="en">Allocation Tracker</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/traceview/index.html">
|
||||
Traceview</a>
|
||||
</li>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/systrace/index.html">
|
||||
Systrace</a>
|
||||
</li>
|
||||
<li class="nav-section">
|
||||
<div class="nav-section-header">
|
||||
<a href="<?cs var:toroot ?>tools/performance/batterystats-battery-historian/index.html">
|
||||
Battery Profilers</a></div>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>tools/performance/batterystats-battery-historian/charts.html"><span
|
||||
class="en">Historian Charts</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li><!-- End Performance Tools menu-->
|
||||
|
||||
|
||||
<!-- Testing Tools menu-->
|
||||
|
||||
<li class="nav-section">
|
||||
|
||||
Reference in New Issue
Block a user