summaryrefslogtreecommitdiffstats
path: root/docs/html/tools/studio/studio-features.jd
blob: 97174620434fb58928debc2fac5014f8ce71122a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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="#finger-print">Fingerprint Support</a></li>
      <li><a href="#support-apis">Editor Support for the Latest Android APIs</a></li>
      <li><a href="#test-module">Test APK Module</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 &gt; Project Structure</strong> and
<strong>File &gt; Settings</strong> menus. For example, you can use the
<strong>File &gt; Project Structure</strong> menu or
the <code>build.gradle</code> file to update your <code>productFlavor</code> settings.
Additional settings from the <strong>File &gt; 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 &gt; Settings</strong> menu to modify the Android Studio or project
behavior, such a UI themes, system settings, and version control. </p>



<h2 id="finger-print">Fingerprint Support</h2>
<p>Android Studio provides the {@code finger} command, allowing you to simulate, and thus validate,
fingerprint authentication for your app. After you set up your app to accept
<a href="https://developer.android.com/preview/api-overview.html#authentication">fingerprint
authentication</a>, your emulator or device should display the fingerprint authentication screen,
as shown below. </p>

    <p><img src="{@docRoot}images/tools/studio-fingerprint.png" /></p>
    <p class="img-caption"><strong>Figure 6</strong> Fingerprint authentication.</p>

<p>Open a terminal session, and telnet to the emulator. For example:</p>
<pre>
{@code telnet localhost 5554}
</pre>

<p>Enter the <code>finger</code> command to simulate finger touch and removal: </p>

<ul>
   <li><code>finger touch &lt;fingerprint-id&gt;</code> to simulate a finger touching the sensor</li>
   <li><code>finger remove</code> to simulate finger removal </li>
</ul>

<p>Your app should respond as if a user touched, and then removed their finger from, the
fingerprint sensor. </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>&lt;ripple&gt;</code>
and <code>&lt;animated-selector&gt;</code>, are supported.</p>



<h2 id="test-module">Test APK Module</h2>
<p>Android Studio supports adding a separate <code>test</code> module to your app so you can
generate a test APK. This <code>test</code> module resides at the same level as your app and
contains: the tests and instrumentation used to run the test APK on an Android device; an
<code>Android Manifest.xml</code> file for test APK configuration settings; and, a
<code>build.gradle</code> file for build settings.</p>

<p>The <code>test</code> module cannot contain a <code>src/androidTest/</code> folder and does
not support build variants. If you have different product flavors in your main application APK,
create a different test module for each build variant.</p>


<p>To create a test APK module:

<ul>
  <li>Use the <strong>File &gt; New &gt; Module</strong> menu option to create a
    <code>test</code> module consisting of the following directories and files:
    <ul>
      <li><code>./test/</code> </li>
      <li><code>./test/build.gradle</code> </li>
      <li><code>./test/src/main/java/com/android/tests/basic/MainTest.java</code> </li>
      <li><code>./test/src/main/AndroidManifest.xml</code> </li>
    </ul>
  </li>
  <li>In the <code>build.gradle</code> file, add the required properties to the
    <code>android</code> block.
    <ul>
      <li><code>targetProjectPath ':&lt;app name&gt;'</code> specifies the main application APK
        to test. </li>
      <li><code>targetVariant ':&lt;buildType&gt;'</code> specifies the target build type.</li>
    </ul>
    <p>Here is an example of <code>build.gradle</code> file property settings: </p>

<pre>
android {
    compileSdkVersion 19
    buildToolsVersion = ‘21.1.3’

    targetProjectPath ':app'
    targetVariant 'debug'
}
</pre>
  </li>
  <li>Define the instrumentation entries in the manifest file.
    <p>Here is an example of <code>&lt;instrumentation&gt;</code> settings in the manifest file: </p>

<pre>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.android.tests.basic.test"&gt;

      &lt;uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16" /&gt;

      &lt;application>
            &gt;uses-library android:name="android.test.runner" /&gt;
      &lt;/application>

      &lt;instrumentation android:name="android.test.InstrumentationTestRunner"
                       android:targetPackage="com.android.tests.basic"
                       android:handleProfiling="false"
                       android:functionalTest="false"
                       android:label="Tests for com.android.tests.basic"/&gt;
&lt;/manifest&lt;
</pre>

<p class="note"><strong>Note:</strong> The <code>targetPackage</code> in the instrumentation
settings specifies the package of the test variant. </p>

   </li>
   <li>In the <code>build.gradle</code> file for the tested app, include additional artifacts
     that the test APK requires, such as the <code> classes.jar</code> file, by adding the
     {@code publishNonDefault} property to the {@code Android} block, and assigning that property
     a value of {@code true}.
     <p>Here is an example of the <code>build.gradle</code> file that includes additional
     artifacts: </p></li>
<pre>
android {
    compileSdkVersion 19
    buildToolsVersion = ‘21.1.3’

    publishNonDefault true
}
</pre>
 </li>
</ul>


<p>In the {@code test} module in this example, the {@code build.gradle} file specifies the
properties for the project path and target build type variant. </p>

    <p><img src="{@docRoot}images/tools/studio-test-module.png" /></p>
    <p class="img-caption"><strong>Figure 3.</strong> Test module for APK testing.</p>


<p class="note"><strong>Note:</strong> By default, the test module's build variant uses the
<code>debug</code> build type. You can configure additional build types using the
<code>testBuildType</code> property in the <code>defaultConfig</code> block in the main
app's <code>build.gradle</code> file. </p>