simplification and clarification to the Studio Overview
am: e9b3ada * commit 'e9b3ada90129b2801047c69001e9eeb4a03861e2': simplification and clarification to the Studio Overview Change-Id: I8418194ba23f39c8022c59f5fd1f6b930dd89f45
This commit is contained in:
BIN
docs/html/images/tools/studio/studio-project-files.png
Normal file
BIN
docs/html/images/tools/studio/studio-project-files.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
@@ -9,9 +9,9 @@ page.tags=studio,sdk,tools,firstapp
|
||||
|
||||
<h2>In this document</h2>
|
||||
<ol>
|
||||
<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="#project-structure">Project Structure</a></li>
|
||||
<li><a href="#build-system">Gradle Build System</a></li>
|
||||
<li><a href="#debug-perf">Debug and Profile Tools</a></li>
|
||||
</ol>
|
||||
|
||||
|
||||
@@ -23,121 +23,91 @@ page.tags=studio,sdk,tools,firstapp
|
||||
</div>
|
||||
|
||||
|
||||
<p>Android Studio is the official IDE for Android app development,
|
||||
based on <a class="external-link" href="https://www.jetbrains.com/idea/" target="_blank">IntelliJ IDEA</a>.
|
||||
On top of the capabilities you expect from IntelliJ,
|
||||
Android Studio offers:</p>
|
||||
<p>Android Studio is the official IDE for Android app development, based on
|
||||
<a class="external-link" href="https://www.jetbrains.com/idea/" target=
|
||||
"_blank">IntelliJ IDEA</a>. On top of IntelliJ's powerful code editor and
|
||||
developer tools, Android Studio offers even more features that enhance your
|
||||
productivity when building Android apps, such as:</p>
|
||||
|
||||
|
||||
<ul>
|
||||
<li>Flexible Gradle-based build system</li>
|
||||
<li>A flexible Gradle-based build system</li>
|
||||
<li>Build variants and multiple APK file generation</li>
|
||||
<li>Code templates to help you build common app features</li>
|
||||
<li>Rich layout editor with support for drag and drop theme editing</li>
|
||||
<li>A rich layout editor with support for drag and drop theme editing</li>
|
||||
<li>Lint tools to catch performance, usability, version compatibility, and other problems</li>
|
||||
<li>Code shrinking with ProGuard</li>
|
||||
<li>Code shrinking with ProGuard and resource shrinking with Gradle</li>
|
||||
<li>Built-in support for
|
||||
<a href="http://developers.google.com/cloud/devtools/android_studio_templates/">Google Cloud Platform</a>,
|
||||
making it easy to integrate Google Cloud Messaging and App Engine</li>
|
||||
<li>And much more</li>
|
||||
</ul>
|
||||
|
||||
<p>This page provides an introduction to some key Android Studio features. 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>. For a summary of the latest changes to
|
||||
Android Studio, see the <a href="{@docRoot}tools/revisions/studio.html">Android
|
||||
Studio Release Notes</a>.</p>
|
||||
<p>This page provides an introduction to basic Android Studio features. For
|
||||
more detailed guides to using Android Studio, start by browsing pages in the
|
||||
<a href="{@docRoot}tools/workflow/index.html">Workflow</a> section.</p>
|
||||
|
||||
<p>For a summary of the latest changes, see the <a href=
|
||||
"{@docRoot}tools/revisions/studio.html">Android Studio Release Notes</a>.</p>
|
||||
|
||||
|
||||
|
||||
<h2 id="project-structure">Project Structure</h2>
|
||||
|
||||
<div class="figure" style="width:230px">
|
||||
<img src="{@docRoot}images/tools/studio/studio-project-files.png" width="230" />
|
||||
<p class="img-caption"><strong>Figure 1.</strong> The project files in Android
|
||||
view.</p>
|
||||
</div>
|
||||
|
||||
<h2 id="project-structure">Project and File Structure</h2>
|
||||
|
||||
<h3 id="project-view"><em>Android</em> project view</h3>
|
||||
<p>By default, Android Studio displays your project files in the <em>Android</em> project view. This
|
||||
view shows a flattened version of your project's structure that provides quick access to the key
|
||||
source files of Android projects and helps you work with the
|
||||
<a href="{@docRoot}sdk/installing/studio-build.html">Gradle-based build system</a>.
|
||||
The <em>Android</em> project view:</p>
|
||||
<p>Each project in Android Studio contains one or more modules with source code
|
||||
files and resource files. Different types of modules include:</p>
|
||||
|
||||
<ul>
|
||||
<li>Shows the most important source directories at the top level of the module hierarchy.</li>
|
||||
<li>Groups the build files for all modules in a common folder.</li>
|
||||
<li>Groups all the manifest files for each module in a common folder.</li>
|
||||
<li>Shows resource files from all Gradle source sets.</li>
|
||||
<li>Groups resource files for different locales, orientations, and screen types in a single
|
||||
group per resource type.</li>
|
||||
<li>Android app modules</li>
|
||||
<li>Test modules</li>
|
||||
<li>Library modules</li>
|
||||
<li>App Engine modules</li>
|
||||
</ul>
|
||||
|
||||
<img src="{@docRoot}images/tools/projectview01.png" />
|
||||
<p class="img-caption"><strong>Figure 1.</strong> Show the Android project view.</p>
|
||||
<img src="{@docRoot}images/tools/studio-projectview_scripts.png" />
|
||||
<p class="img-caption"><strong>Figure 2.</strong> Show project build files.</p>
|
||||
|
||||
<p>The <em>Android</em> project view shows all the build files at the top level of the project
|
||||
hierarchy under <strong>Gradle Scripts</strong>. Each project module appears as a folder at the
|
||||
top level of the project hierarchy and contains these four elements at the top level:</p>
|
||||
<p>By default, Android Studio displays your project files in the
|
||||
<em>Android</em> project view, as shown in figure 1.
|
||||
This view is organized by modules to
|
||||
provide quick access to the key source files of your
|
||||
project.</p>
|
||||
|
||||
<p>All the build files are visible at the top level
|
||||
under <strong>Gradle Scripts</strong> and each app module
|
||||
contains the following three elements:</p></p>
|
||||
<ul>
|
||||
<li><code>java/</code> - Source files for the module.</li>
|
||||
<li><code>manifests/</code> - Manifest files for the module.</li>
|
||||
<li><code>res/</code> - Resource files for the module.</li>
|
||||
<li><code>Gradle Scripts/</code> - Gradle build and property files.</li>
|
||||
<li><b>manifests</b>: Manifest files.</li>
|
||||
<li><b>java</b>: Source code files.</li>
|
||||
<li><b>res</b>: Resource files.</li>
|
||||
</ul>
|
||||
|
||||
<p>For example, <em>Android</em> project view groups all the instances of the
|
||||
<code>ic_launcher.png</code> resource for different screen densities under the same element.</p>
|
||||
<p>The Android project structure on disk differs
|
||||
from this flattened representation. To see the actual file structure of the
|
||||
project, select <strong>Project</strong> from the <strong>Project</strong>
|
||||
drop-down (in figure 1, it's showing as <strong>Android</strong>).</p>
|
||||
|
||||
<p class="note"><strong>Note:</strong> The project structure on disk differs from this flattened
|
||||
representation. To switch to back to the segregated project view, select <strong>Project</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
|
||||
instance of Android Studio contains a project with one or more app modules. Each
|
||||
app module folder contains the complete source sets for that module, including
|
||||
{@code src/main/} and {@code src/androidTest/} directories, resources, build
|
||||
file and the Android manifest. For the most part, you will need to modify the files under each
|
||||
module's {@code src/main/} directory for source code updates, the gradle.build file for build
|
||||
specification and the files under {@code src/androidTest/} directory for test case creation.
|
||||
|
||||
<p> <img src="{@docRoot}images/tools/studio-project-layout.png" alt="" /></p>
|
||||
<p> <class="img-caption"><strong>Figure 3.</strong> View Android Studio <em>Project</em>
|
||||
structure.</p>
|
||||
|
||||
<p>You can also customize the view of the project files to focus on specific aspects of your app
|
||||
development: </p>
|
||||
|
||||
<ul>
|
||||
<li><em>Packages</em> </li>
|
||||
<li><em>Project Files</em> </li>
|
||||
<li><em>Scratches</em> </li>
|
||||
<li><em>Problems</em> </li>
|
||||
<li><em>Production</em> </li>
|
||||
<li><em>Tests</em> </li>
|
||||
</ul>
|
||||
|
||||
<p>For example, selecting the <strong>Problems</strong> view of your project displays links to the
|
||||
source files containing any recognized coding and syntax errors, such as missing an XML element
|
||||
closing tag in a layout file.<p>
|
||||
<p>You can also customize the view of the project files to focus on specific
|
||||
aspects of your app development. For example, selecting the
|
||||
<strong>Problems</strong> view of your project displays links to the source
|
||||
files containing any recognized coding and syntax errors, such as missing an
|
||||
XML element closing tag in a layout file.</p>
|
||||
|
||||
<p>For more information, see
|
||||
<a class="external-link" href="http://confluence.jetbrains.com/display/IntelliJIDEA/Project+Organization">IntelliJ project organization</a>
|
||||
and <a href="{@docRoot}tools/projects/index.html">Managing Projects</a>.</p>
|
||||
|
||||
|
||||
<h2 id="build-system">Gradle Build System</h2>
|
||||
|
||||
<h2 id="build-system">Android Build System</h2>
|
||||
<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
|
||||
the features of the build system to:</p>
|
||||
<p>Android Studio uses Gradle as the foundation of the build system, with
|
||||
more Android-specific capabilities provided by the <a
|
||||
href="{@docRoot}tools/revisions/gradle-plugin.html">Android Plugin for
|
||||
Gradle</a>. This build system
|
||||
runs as an integrated tool from the Android Studio menu and independently from
|
||||
the command line. You can use the features of the build system to:</p>
|
||||
|
||||
<ul>
|
||||
<li>Customize, configure, and extend the build process.</li>
|
||||
@@ -146,39 +116,30 @@ the features of the build system to:</p>
|
||||
<li>Reuse code and resources across source sets.</li>
|
||||
</ul>
|
||||
|
||||
<p>The flexibility of the Android build system enables you to achieve all of this without
|
||||
<p>The flexibility of Gradle enables you to achieve all of this without
|
||||
modifying your app's core source files. To build an Android Studio project, see
|
||||
<a href="{@docRoot}tools/building/building-studio.html">Building and Running from Android Studio</a>.
|
||||
To configure custom build settings in an Android Studio project, see
|
||||
<a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>.</p>
|
||||
<a href="{@docRoot}tools/building/building-studio.html">Building and Running
|
||||
from Android Studio</a>. To configure custom build settings in an Android
|
||||
Studio project, see <a href=
|
||||
"{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle
|
||||
Builds</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
|
||||
|
||||
<h2 id="debug-perf">Debug and Profile Tools</h2>
|
||||
|
||||
<p>Android Studio assists you in debugging and improving the
|
||||
performance of your code, including 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
|
||||
configurations, screen sizes and resolutions for your app previews.</p>
|
||||
Click the <strong>Android Virtual Device Manager</strong>
|
||||
<img src="{@docRoot}images/tools/avd-manager-studio.png"
|
||||
style="vertical-align:bottom;margin:0;height:19px" /> in the toolbar to open it and create
|
||||
new virtual devices for running your app in the emulator.</p>
|
||||
|
||||
<p>The AVD Manager comes with emulators for Nexus 6 and Nexus 9 devices and also supports
|
||||
creating custom Android device skins based on specific emulator properties and assigning those
|
||||
skins to hardware profiles. Android Studio installs the Intel® x86 Hardware Accelerated Execution
|
||||
Manager (HAXM) emulator accelerator and creates a default emulator for quick app prototyping.</p>
|
||||
|
||||
<p>For more information, see <a href="{@docRoot}tools/devices/managing-avds.html">Managing AVDs</a>.</p>
|
||||
|
||||
|
||||
<h3 id="inline-debug">Inline debugging</h3>
|
||||
|
||||
<p>Use inline debugging to enhance your code walk-throughs in the debugger view
|
||||
with inline verification of references, expressions, and variable values. Inline debug information
|
||||
includes: </p>
|
||||
with inline verification of references, expressions, and variable values.
|
||||
Inline debug information includes:</p>
|
||||
|
||||
<ul>
|
||||
<li>Inline variable values</li>
|
||||
<li>Referring objects that reference a selected object </li>
|
||||
@@ -201,7 +162,7 @@ runtime window to launch the Android runtime window. Click the <strong>Memory</s
|
||||
|
||||
<img src="{@docRoot}images/tools/studio-memory-monitor.png"
|
||||
srcset="{@docRoot}images/tools/studio-memory-monitor2x.png 2x" width"635" height="171" alt="" />
|
||||
<p class="img-caption"><strong>Figure 4.</strong> Monitor memory and CPU usage.</p>
|
||||
<p class="img-caption"><strong>Figure 2.</strong> Monitor memory and CPU usage.</p>
|
||||
|
||||
<h4 id="heap-dump">Heap dump </h4>
|
||||
<p>When you're monitoring memory usage in Android Studio you can, at the same time, initiate
|
||||
@@ -210,7 +171,7 @@ format file. The HPROF viewer displays classes, instances of each class, and a r
|
||||
help you track memory usage and find memory leaks. </p>
|
||||
|
||||
<img src="{@docRoot}images/tools/studio-hprof-viewer.png" alt="" />
|
||||
<p class="img-caption"><strong>Figure 5.</strong> HPROF viewer with heap dump.</p>
|
||||
<p class="img-caption"><strong>Figure 3.</strong> HPROF viewer with heap dump.</p>
|
||||
|
||||
<p>To create a snapshot of the Android app heap memory, click the
|
||||
Dump Java Heap icon (<img src="{@docRoot}images/tools/studio-dump-heap-icon.png" style="vertical-align:bottom;margin:0;height:17px"/>)
|
||||
@@ -230,7 +191,7 @@ Knowing these allocations enables you to adjust the method
|
||||
calls related to those actions to optimize your app's performance and memory use. </p>
|
||||
|
||||
<img src="{@docRoot}images/tools/studio-allocation-tracker.png" alt="" />
|
||||
<p class="img-caption"><strong>Figure 6.</strong> Allocation tracker.</p>
|
||||
<p class="img-caption"><strong>Figure 4.</strong> Allocation tracker.</p>
|
||||
|
||||
<p>For information about tracking and analyzing allocations, see
|
||||
<a href="{@docRoot}/tools/help/am-memory.html#tracking">Memory Monitor</a>.
|
||||
@@ -311,17 +272,6 @@ to <em>error</em>. </p>
|
||||
The <em>Inspections Scope</em> dialog appears so you can specify the desired inspection profile and scope.</p>
|
||||
|
||||
|
||||
|
||||
<h4>Running inspections from the command line</h4>
|
||||
<p>You can also run {@code lint} inspections from the command line in your SDK directory. </p>
|
||||
<pre>
|
||||
sdk$ lint [flags] <project directories>
|
||||
</pre>
|
||||
|
||||
<p class="note"><strong>Note:</strong> The {@code lint} <strong>--show</strong> and <strong>--list</strong>
|
||||
flags can be used to display the available issues and explanations. </p>
|
||||
|
||||
|
||||
<p>For more information, see
|
||||
<a href="{@docRoot}tools/debugging/improving-w-lint.html">Improving Your Code with {@code lint}</a>
|
||||
and <a href="{@docRoot}tools/help/lint.html">lint tool</a>.</p>
|
||||
|
||||
Reference in New Issue
Block a user