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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
|
page.title=Android Studio Overview
page.image=images/cards/card-android-studio-overview_16x9_2x.jpg
page.metaDescription=Learn about the official IDE for Android.
page.tags=studio,sdk,tools,firstapp
@jd:body
<div id="qv-wrapper">
<div id="qv">
<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="#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>
<h2>See also</h2>
<ol>
<li><a class="external-link" href="http://confluence.jetbrains.com/display/IntelliJIDEA/FAQ+on+Migrating+to+IntelliJ+IDEA">IntelliJ FAQ on migrating to IntelliJ IDEA</a></li>
</ol>
</div>
</div>
<p>Android Studio is the official IDE for Android application 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>
<ul>
<li>Flexible Gradle-based build system</li>
<li>Build variants and multiple <code>apk</code> 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>{@code lint} tools to catch performance, usability, version compatibility, and other problems</li>
<li>ProGuard and app-signing capabilities</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><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
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}tools/projects/projects-studio.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>
<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>
<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>
</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>
<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>
</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 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 application modules. Each
application 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>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>
<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
the features of the build system to:</p>
<ul>
<li>Customize, configure, and extend the build process.</li>
<li>Create multiple APKs for your app with different features using the same project and
modules.</li>
<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
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>
<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>
<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>
<ul>
<li>Inline variable values</li>
<li>Referring objects that reference a selected object </li>
<li>Method return values</li>
<li>Lambda and operator expressions</li>
<li>Tool tip values</li>
</ul>
<p>To enable inline debugging, in the <em>Debug</em> window click the Settings icon
<img src="{@docRoot}images/tools/studio-debug-settings-icon.png"/> and select the
check box for <strong>Show Values In Editor</strong>.</p>
<h3 id="mem-cpu">Memory and CPU monitor</h3>
<p>Android Studio provides a memory and CPU monitor view so you can more easily monitor your
app's performance and memory usage to track CPU usage, find deallocated objects, locate memory
leaks, and track the amount of memory the connected device is using. With your app running on a
device or emulator, click the <strong>Android</strong> tab in the lower left corner of the
runtime window to launch the Android runtime window. Click the <strong>Memory</strong> or
<strong>CPU</strong> tab. </p>
<img src="{@docRoot}images/tools/studio-memory-monitor.png" srcset="{@docRoot}images/tools/studio-memory-monitor_2x.png 2x" width"635" height="171" alt="" />
<p class="img-caption"><strong>Figure 4.</strong> Monitor memory and CPU usage.</p>
<h3>Data file access</h3>
<p>The Android SDK tools, such as <a href="{@docRoot}tools/help/systrace.html">Systrace</a>,
<a href="{@docRoot}tools/help/logcat.html">logcat</a>, and
<a href="{@docRoot}tools/help/traceview.html">Traceview</a>, generate performance and debugging
data for detailed app analysis.</p>
<p>To view the available generated data files, click <strong>Captures</strong> in the left
corner of the runtime window. In the list of the generated files, double-click a file to view
the data. Right-click any <code>.hprof</code> files to convert them to a standard
<a href="{@docRoot}tools/help/hprof-conv.html"><code>.hprof</code> </a> file format.</p>
<h3>Code inspections</h3>
<p>In Android Studio, the configured <a href="{@docRoot}tools/help/lint.html"><code>lint</code></a>
and other IDE inspections run automatically whenever you compile your program. In addition to the
configured {@code lint} checks, additional
<a class="external-link" href="https://www.jetbrains.com/idea/help/inspection-basics.html?search=inspection"
target="_blank">IntelliJ code inspections</a> and annotation validation run to streamline code
review.</p>
<p>Android Studio enables several <code>lint</code> checks
to ensure:
<ul>
<li><code> Cipher.getInstance()</code> is used with safe values</li>
<li>In custom Views, the associated declare-styleable for the custom view uses the same
base name as the class name</li>
<li>Security check for fragment injection</li>
<li>Where ever property assignment no longer works as expected</li>
<li>Gradle plugin version is compatible with the SDK</li>
<li>Right to left validation </li>
<li>Required API version</li>
<li>many others</li>
</ul>
<p>Hovering over an inspection error displays the full issue explanation inline for easy error
resolution. There is also a helpful hyperlink at the end of the error message for additional
error information.</p>
<p>With Android Studio, you can also run {@code lint} inspections for a specific build variant, or
for all build variants. You can configure the {@code lint} inspections that run by adding a
<code>lintOptions</code> property to the Android settings in the <code>build.gradle</code>
file. </p>
<pre>
android {
lintOptions {
// set to true to turn off analysis progress reporting by lint
quiet true
// if true, stop the gradle build if errors are found
abortOnError false
// if true, only report errors
ignoreWarnings true
}
</pre>
<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>.
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>
<p class="note"><strong>Note:</strong> To change the behavior of specific
inspection notifications, change the inspection severity, for example from <em>warning</em>
to <em>error</em>. </p>
<p>To manually run inspections in Android Studio, choose <strong>Analyze > Inspect Code</strong>.
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>
<h3 id="annotations">Annotations in Android Studio</h3>
<p>Android Studio supports annotations for variables, parameters, and return values to help you
catch bugs, such as null pointer exceptions and resource type conflicts. The
<a href="{@docRoot}tools/help/sdk-manager.html">Android SDK Manager</a> packages
the {@link android.support.annotation Support-Annotations} library
in the Android Support Repository for use with Android
Studio. Android Studio validates the configured annotations during code inspection. </p>
<p>To add annotations to your code in Android Studio, first add a dependency for the
{@link android.support.annotation Support-Annotations} library:</p>
<ol>
<li>Select <strong>File > Project Structure</strong>.</li>
<li>In the <em>Project Structure</em> dialog, select the desired module, click the
<strong>Dependencies</strong> tab. </li>
<li>Click the <img src="{@docRoot}images/tools/studio-add-icon.png"/> icon to include a
<strong>Library dependency</strong>.</li>
<li>In the <em>Choose Library Dependency</em> dialog, select <code>support-annotations</code> and
click <strong>Ok</strong>. </li>
</ol>
<p>The <code>build.gradle</code> file is updated with the <code>support-annotations</code>
dependency.</p>
<p>You can also manually add this dependency to your <code>build.gradle</code> file, as shown in
the following example. </p>
<pre>
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
<strong>compile 'com.android.support:support-annotations:22.0.0'</strong>
}
</pre>
<h4>Inferring nullability</h4>
<p>A nullability analysis scans the contracts throughout the method hierarchies in your code to
detect:</p>
<ul>
<li>Calling methods that can return null </li>
<li>Methods that should not return null </li>
<li>Variables, such as fields, local variables, and parameters, that can be null </li>
<li>Variables, such as fields, local variables, and parameters, that cannot hold a null value </li>
</ul>
<p>The analysis then automatically inserts the appropriate null annotations in the detected
locations. </p>
<p>To run a nullability analysis in Android Studio,
select the <strong>Analyze > Infer Nullity</strong>
menu option. Android Studio inserts the Android
{@link android.support.annotation.Nullable @Nullable} and
{@link android.support.annotation.NonNull @NonNull} annotations in detected locations
in your code. After running a null analysis, it's good practice to verify the injected
annotations.</p>
<p class="note"><strong>Note:</strong> The nullability analysis may insert the IntelliJ
<a class="external-link" href="https://www.jetbrains.com/idea/help/-nullable-and-notnull-annotations.html?search=annotations">
<code>@Nullable</code></a> and
<a class="external-link" href="https://www.jetbrains.com/idea/help/-nullable-and-notnull-annotations.html?search=annotations">
<code>@NotNull</code></a> annotations instead of the Android null annotations. When running
a null analysis, manually search and replace any IntelliJ annotations or include
<code>com.intellij:annotations:12.0</code> as a compile dependency in your
<code>build.gradle</code> file. This example includes the IntelliJ annotations 12.0 library as a
dependency in the <code>build.gradle</code> file:
<pre>
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-annotations:22.0.0'
<strong>compile 'com.intellij:annotations:12.0'</strong>
}
</pre>
</p>
<h4>Validating annotations</h4>
<p>You can also manually add nullability, resource, and enumerated annotations throughout your code
to perform validations for a variety of reference values, such as
<a href="{@docRoot}reference/android/R.string.html"><code>R.string</code></a> resources,
<a href="{@docRoot}guide/topics/resources/drawable-resource.htm"><code>Drawable</code></a>
resources,
<a href="{@docRoot}reference/android/graphics/Color.html"><code>Color</code></a> resources,
and enumerated constants. </p>
<p>Run <strong>Analyze > Inspect Code</strong> to validate the configured annotations. </p>
<p>For a complete list of the supported annotations, either use the auto-complete feature to display
the available options for the <code>import android.support.annotation.</code> statement or
view the contents of the
{@link android.support.annotation Support-Annotations}
library. </p>
<p>For more details about Android annotations, see
<a href="{@docRoot}tools/debugging/annotations.html">Improving Code Inspection with Annotations</a>.
<h3>Dynamic layout preview</h3>
<p>Android Studio allows you to work with layouts in both a <em>Design View</em> </p>
<p><img src="{@docRoot}images/tools/studio-helloworld-design.png" alt="" />
</p>
<p class="img-caption"><strong>Figure 6.</strong> Hello World App with Design View.</p>
<p>and a <em>Text View</em>. </p>
<p><img src="{@docRoot}images/tools/studio-helloworld-text.png" alt="" />
<pclass="img-caption"><strong>Figure 7.</strong> Hello World App with text view.</p>
<p>Easily select and preview layout changes for different device images, display
densities, UI modes, locales, and Android versions (multi-API version rendering).
<p><img src="{@docRoot}images/tools/studio-api-version-rendering.png" /></p>
<p class="img-caption"><strong>Figure 8.</strong> Multi-API version rendering.</p>
<p>From the Design View, you can drag and drop elements from the Palette to the Preview or
Component Tree. The Text View allows you to directly edit the XML settings, while previewing
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>
<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
clicking <strong>Monitor</strong>
<img src="{@docRoot}images/tools/monitor-studio.png" style="vertical-align:bottom;margin:0;height:19px"/>
in the toolbar. The Debug Monitor is where you can find the complete set of
<a href="{@docRoot}tools/debugging/ddms.html">DDMS</a> tools for profiling your app,
controlling device behaviors, and more. It also includes the Hierarchy Viewer tools to help
<a href="{@docRoot}tools/debugging/debugging-ui.html"> optimize your layouts</a>.</p>
<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>
|