diff options
Diffstat (limited to 'docs/html')
33 files changed, 2506 insertions, 481 deletions
diff --git a/docs/html/design/design_toc.cs b/docs/html/design/design_toc.cs index 85569ef..477eb23 100644 --- a/docs/html/design/design_toc.cs +++ b/docs/html/design/design_toc.cs @@ -3,13 +3,29 @@ <li class="nav-section"> <div class="nav-section-header"><a href="<?cs var:toroot ?>design/get-started/creative-vision.html">Creative Vision</a></div> <ul> - <li><a href="<?cs var:toroot ?>design/get-started/principles.html">Design Principles</a></li> + <li><a href="<?cs var:toroot ?>design/get-started/principles.html" + es-lang="Principios de diseño para Android" + ja-lang="Android デザイン指針" + ko-lang="Android 디자인 원칙" + pt-br-lang="Princípios de projeto para Android" + ru-lang="Принципы проектирования Android" + zh-cn-lang="Android 设计原则" + zh-tw-lang="Android 設計原則"> + Design Principles</a></li> <li><a href="<?cs var:toroot ?>design/patterns/new.html">New in Android</a></li> </ul> </li> <li class="nav-section"> - <div class="nav-section-header empty"><a href="<?cs var:toroot ?>design/material/index.html">Material for Android</a></div> + <div class="nav-section-header empty"><a href="<?cs var:toroot ?>design/material/index.html" + es-lang="Material Design" + ja-lang="マテリアル デザイン" + ko-lang="머티어리얼 디자인" + pt-br-lang="Material Design" + ru-lang="Material Design" + zh-cn-lang="材料设计" + zh-tw-lang="材料設計"> + Material for Android</a></div> </li> <li class="nav-section"> @@ -47,12 +63,39 @@ <ul> <li><a href="<?cs var:toroot ?>design/style/devices-displays.html">Devices and Displays</a></li> <li><a href="<?cs var:toroot ?>design/patterns/app-structure.html">App Structure</a></li> - <li><a href="<?cs var:toroot ?>design/patterns/navigation.html">Navigation</a></li> - <li><a href="<?cs var:toroot ?>design/patterns/notifications.html">Notifications</a></li> + <li><a href="<?cs var:toroot ?>design/patterns/navigation.html" + es-lang="Navegación con los botones Back y Up" + ja-lang="Back と Up を使用したナビゲーション" + ko-lang="뒤로 및 위로 탐색 기능이 포함된 탐색" + pt-br-lang="Navegação com Voltar e Para cima" + ru-lang="Навигация с помощью кнопок \"Назад\" и \"Вверх\"" + zh-cn-lang="使用返回和向上导航" + zh-tw-lang="使用 [返回] 及 [上一層] 導覽"> + Navigation</a></li> + + <li><a href="<?cs var:toroot ?>design/patterns/notifications.html" + es-lang="Notificaciones" + ja-lang="通知" + ko-lang="알림" + pt-br-lang="Notificações" + ru-lang="Уведомления" + zh-cn-lang="通知" + zh-tw-lang="通知"> + Notifications</a></li> <li><a href="<?cs var:toroot ?>design/patterns/widgets.html">Widgets</a></li> <li><a href="<?cs var:toroot ?>design/patterns/swipe-views.html">Swipe Views</a></li> <li><a href="<?cs var:toroot ?>design/patterns/fullscreen.html">Full Screen</a></li> - <li><a href="<?cs var:toroot ?>design/patterns/confirming-acknowledging.html">Confirming & Acknowledging</a></li> + + <li><a href="<?cs var:toroot ?>design/patterns/confirming-acknowledging.html" + es-lang="Confirmación y reconocimiento" + ja-lang="確認と通知" + ko-lang="확인 및 승인하기" + pt-br-lang="Confirmação e reconhecimento" + ru-lang="Подтверждение и уведомление" + zh-cn-lang="确认和确知" + zh-tw-lang="確認及確認完成"> + Confirming & Acknowledging</a></li> + <li><a href="<?cs var:toroot ?>design/patterns/pure-android.html">Pure Android</a></li> <li><a href="<?cs var:toroot ?>design/patterns/compatibility.html">Compatibility</a></li> <li><a href="<?cs var:toroot ?>design/patterns/accessibility.html">Accessibility</a></li> diff --git a/docs/html/distribute/googleplay/googleplay_toc.cs b/docs/html/distribute/googleplay/googleplay_toc.cs index d55271b..60da6d2 100644 --- a/docs/html/distribute/googleplay/googleplay_toc.cs +++ b/docs/html/distribute/googleplay/googleplay_toc.cs @@ -1,48 +1,104 @@ <ul id="nav"> <li class="nav-section"> - <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/about.html"> - <span class="en">The Google Play Opportunity</span></a> + <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/about.html" + es-lang="La oportunidad de Google Play" + ja-lang="Google Play の可能性" + ko-lang="Google Play 활용 기회" + pt-br-lang="A oportunidade do Google Play" + ru-lang="Возможности Google Play" + zh-cn-lang="Google Play 蕴藏的机会" + zh-tw-lang="Google Play商機" + >The Google Play Opportunity</span></a> </div> </li> <li class="nav-section"> - <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/start.html"> - <span class="en">Get Started <br />with Publishing</span> + <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/start.html" + es-lang="Comienza a publicar" + ja-lang="アプリを公開する" + ko-lang="게시 시작하기" + pt-br-lang="Introdução à publicação" + ru-lang="Первые шаги в публикациях" + zh-cn-lang="开始发布" + zh-tw-lang="開始發行"> + Get Started <br />with Publishing </a> </div> </li> <li class="nav-section"> - <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/developer-console.html"> - <span class="en">Developer Console</span> + <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/developer-console.html" + es-lang="Consola para desarrolladores" + ja-lang="デベロッパー コンソール" + ko-lang="개발자 콘솔" + pt-br-lang="Console do Desenvolvedor" + ru-lang="Консоль разработчика" + zh-cn-lang="开发者控制台" + zh-tw-lang="Developer Console"> + Developer Console </a> </div> </li> <li class="nav-section"> - <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/guide.html"> - <span class="en">Find Success on <span style="white-space:nowrap">Google Play</span></span> + <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/guide.html" + es-lang="Cómo tener éxito en Google Play" + ja-lang="Google Play で成功を手にする" + ko-lang="Google Play에서 성공 모색" + pt-br-lang="Obtendo sucesso no Google Play" + ru-lang="Найдите свой путь к успеху в Google Play" + zh-cn-lang="在 Google Play 上取得成功" + zh-tw-lang="在 Google Play 上尋找成功"> + Find Success on <span style="white-space:nowrap">Google Play </a> </div> </li> <li class="nav-section"> - <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/wear.html"> + <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/wear.html" + es-lang="Distribución para Android Wear" + ja-lang="Android Wear への配布" + ko-lang="Android Wear에 배포" + pt-br-lang="Distribuindo para Android Wear" + ru-lang="Распространение приложений Android Wear" + zh-cn-lang="分发到 Android Wear" + zh-tw-lang="散佈至 Android Wear"> <span class="en">Distribute to <br /><span style="white-space:nowrap">Android Wear</span></span> </a> </div> </li> <li class="nav-section"> - <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/tv.html"> + <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/tv.html" + es-lang="Distribución para Android TV" + ja-lang="Android TV への配布" + ko-lang="Android TV에 배포" + pt-br-lang="Distribuindo para Android TV" + ru-lang="Распространение приложений в Android TV" + zh-cn-lang="分发到 Android TV" + zh-tw-lang="散佈至 Android 電視"> <span class="en">Distribute to <br /><span style="white-space:nowrap">Android TV</span></span> </a> </div> </li> <li class="nav-section"> - <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/auto.html"> + <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/auto.html" + es-lang="Distribución para Android Auto" + ja-lang="Android Auto への配布" + ko-lang="Android Auto에 배포" + pt-br-lang="Distribuindo para o Android Auto" + ru-lang="Распространение приложений для Android Auto" + zh-cn-lang="分发到 Android Auto" + zh-tw-lang="散佈至 Android Auto"> <span class="en">Distribute to <br /><span style="white-space:nowrap">Android Auto</span></span> </a> </div> </li> <li class="nav-section"> - <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/families/about.html"> + <div class="nav-section-header empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/googleplay/families/about.html" + es-lang="Diseñado para la familia" + ja-lang="Designed for Families" + ko-lang="Designed for Families" + pt-br-lang="Designed for Families" + ru-lang="Для всей семьи" + zh-cn-lang="为家庭设计" + zh-tw-lang="Designed for Families"> <span class="en">Designed for Families</span> </a> </div> diff --git a/docs/html/google/google_toc.cs b/docs/html/google/google_toc.cs index dd0e735..ffdc22d 100644 --- a/docs/html/google/google_toc.cs +++ b/docs/html/google/google_toc.cs @@ -47,8 +47,15 @@ </li> <li class="nav-section"> - <div class="nav-section-header empty"><a href="<?cs var:toroot ?>google/play/filters.html"> - <span class="en">Filters on Google Play</span></a> + <div class="nav-section-header empty"><a href="<?cs var:toroot ?>google/play/filters.html" + es-lang="Filtros en Google Play" + ja-lang="Google Play 上のフィルタ" + ko-lang="Google Play 필터" + pt-br-lang="Filtros no Google Play" + ru-lang="Фильтры в Google Play" + zh-cn-lang="Google Play 上的筛选器" + zh-tw-lang="Google Play 上的篩選器"> + Filters on Google Play</a> </div> </li> diff --git a/docs/html/guide/topics/security/permissions.jd b/docs/html/guide/topics/security/permissions.jd index 6f919da..cfab3c9 100644 --- a/docs/html/guide/topics/security/permissions.jd +++ b/docs/html/guide/topics/security/permissions.jd @@ -52,9 +52,7 @@ must explicitly share resources and data. They do this by declaring the <em>permissions</em> they need for additional capabilities not provided by the basic sandbox. Applications statically declare the permissions they require, and the Android system prompts the user for consent at the time the -application is installed. Android has no mechanism for granting permissions -dynamically (at run-time) because it complicates the user experience to the -detriment of security.</p> +application is installed.</p> <p>The application sandbox does not depend on the technology used to build an application. In particular the Dalvik VM is not a security boundary, and diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd index d972c47..b2f98ad 100644 --- a/docs/html/guide/topics/ui/actionbar.jd +++ b/docs/html/guide/topics/ui/actionbar.jd @@ -907,11 +907,7 @@ to ensure the best fit in the action bar.</p> <p>To get started, your layout must include a {@link android.view.ViewGroup} in which you place each {@link android.app.Fragment} associated with a tab. Be sure the {@link android.view.ViewGroup} has a resource ID so you can reference it from your code and swap the tabs within it. -Alternatively, if the tab content will fill the activity layout, then your activity doesn't need a -layout at all (you don't even need to call {@link android.app.Activity#setContentView -setContentView()}). Instead, you can place each fragment in the default root view, which you can -refer to with the {@code android.R.id.content} ID.</p> - +</p> <p>Once you determine where the fragments appear in the layout, the basic procedure to add tabs is:</p> diff --git a/docs/html/images/tools/eclipse-notepad-pre-import--structure.png b/docs/html/images/tools/eclipse-notepad-pre-import--structure.png Binary files differnew file mode 100644 index 0000000..b9c3814 --- /dev/null +++ b/docs/html/images/tools/eclipse-notepad-pre-import--structure.png diff --git a/docs/html/images/tools/studio-globe-icon.png b/docs/html/images/tools/studio-globe-icon.png Binary files differnew file mode 100644 index 0000000..0701dd2 --- /dev/null +++ b/docs/html/images/tools/studio-globe-icon.png diff --git a/docs/html/images/tools/studio-import-destination-dir.png b/docs/html/images/tools/studio-import-destination-dir.png Binary files differnew file mode 100644 index 0000000..d1c6c70 --- /dev/null +++ b/docs/html/images/tools/studio-import-destination-dir.png diff --git a/docs/html/images/tools/studio-import-options.png b/docs/html/images/tools/studio-import-options.png Binary files differnew file mode 100644 index 0000000..f14eca0 --- /dev/null +++ b/docs/html/images/tools/studio-import-options.png diff --git a/docs/html/images/tools/studio-import-project-structure-android.png b/docs/html/images/tools/studio-import-project-structure-android.png Binary files differnew file mode 100644 index 0000000..4cd7186 --- /dev/null +++ b/docs/html/images/tools/studio-import-project-structure-android.png diff --git a/docs/html/images/tools/studio-import-project-structure-project.png b/docs/html/images/tools/studio-import-project-structure-project.png Binary files differnew file mode 100644 index 0000000..c7ffda8 --- /dev/null +++ b/docs/html/images/tools/studio-import-project-structure-project.png diff --git a/docs/html/images/tools/studio-import-summary.png b/docs/html/images/tools/studio-import-summary.png Binary files differnew file mode 100644 index 0000000..a85e339 --- /dev/null +++ b/docs/html/images/tools/studio-import-summary.png diff --git a/docs/html/images/tools/studio-select-project-forimport.png b/docs/html/images/tools/studio-select-project-forimport.png Binary files differnew file mode 100644 index 0000000..c6a3599 --- /dev/null +++ b/docs/html/images/tools/studio-select-project-forimport.png diff --git a/docs/html/images/tools/studio-setup-wizard.png b/docs/html/images/tools/studio-setup-wizard.png Binary files differdeleted file mode 100644 index ccd92d3..0000000 --- a/docs/html/images/tools/studio-setup-wizard.png +++ /dev/null diff --git a/docs/html/preview/features/runtime-permissions.jd b/docs/html/preview/features/runtime-permissions.jd index b4eed9a..79f0d88 100644 --- a/docs/html/preview/features/runtime-permissions.jd +++ b/docs/html/preview/features/runtime-permissions.jd @@ -22,7 +22,7 @@ page.image=images/permissions_check.png <li><a href="#overview">Overview</a></li> <li><a href="#coding">Coding for Runtime Permissions</a></li> <li><a href="#testing">Testing Runtime Permissions</a></li> - <li><a href="#best-practices">Best Practices</a></li> + <li><a href="#best-practices">Best Practices and Usage Notes</a></li> </ol> <!-- @@ -82,15 +82,17 @@ page.image=images/permissions_check.png <li> <p><strong>Limited Permissions Granted at Install Time:</strong> When the user installs or updates the app, the system grants the app all - permissions that the app requests that fall under {@link + permissions listed in the manifest that fall under {@link android.content.pm.PermissionInfo#PROTECTION_NORMAL PROTECTION_NORMAL}. For example, alarm clock and internet permissions fall under {@link android.content.pm.PermissionInfo#PROTECTION_NORMAL PROTECTION_NORMAL}, so - they are automatically granted at install time. + they are automatically granted at install time. For more information about + how normal permissions are handled, see <a href="#normal">Normal + Permissions</a>. </p> - <p>The system may also grant the app signature and system permissions, as - described in <a href="#system-apps">System apps and signature + <p>The system may also grant the app signature permissions, as + described in <a href="#system-apps">System components and signature permissions</a>. The user is <em>not</em> prompted to grant any permissions at install time.</p> </li> @@ -98,9 +100,7 @@ page.image=images/permissions_check.png <li> <strong>User Grants Permissions at Run-Time:</strong> When the app requests a permission, the system shows a dialog to the user, then calls the app's - callback function to notify it whether the permission was granted. If a - user grants a permission, the app is given all permissions in that - permission's functional area that were declared in the app manifest. + callback function to notify it whether the user granted the permission. </li> </ul> @@ -117,7 +117,9 @@ page.image=images/permissions_check.png <strong>Always Check for Permissions:</strong> When the app needs to perform any action that requires a permission, it should first check whether it has that permission already. If it does not, it requests to be - granted that permission. + granted that permission. You do not need to check for permissions that + fall under {@link + android.content.pm.PermissionInfo#PROTECTION_NORMAL PROTECTION_NORMAL}. </li> <li> @@ -164,38 +166,59 @@ page.image=images/permissions_check.png to access that data. </p> +<h3 id="perm-groups">Permission groups</h3> + +<p> + Related permissions are divided into <em>permission groups</em> to + allow users to grant related permissions to an app in a single action. + The user only has to grant permission once per app for each permission group. + If the app subsequently requests a permission from the same permission + group, the system automatically grants the permission without any action from + the user. The system calls your app's <code>onRequestPermissionsResult()</code> + method just as if the user had granted permission through the dialog box. +</p> + +<p> + For example, suppose an app lists in its manifest that it needs the + <code>SEND_SMS</code> and <code>RECEIVE_SMS</code> permissions, which both + belong to <code>android.permission-group.SMS</code>. When the app needs to + send a message, it requests the <code>SEND_SMS</code> permission. The system + shows the user a dialog box asking if the app can have access to SMS. If the + user agrees, the system grants the app the <code>SEND_SMS</code> permission it + requested. Later, the app requests <code>RECEIVE_SMS</code>. The + system automatically grants this permission, since the user had already + approved a permission in the same permission group. +</p> + <h3 id="system-apps"> - System apps and signature permissions + System components and signature permissions </h3> <p> Ordinarily, when the user installs an app, the system only grants the app the + permissions listed in the manifest that fall under {@link android.content.pm.PermissionInfo#PROTECTION_NORMAL PROTECTION_NORMAL}. However, under some circumstances the system grants the app more permissions: </p> <ul> - <li>If an app is part of the system image, it is automatically granted all - the permissions listed in its manifest. + <li>System components automatically receive all + the permissions listed in their manifests. However, the user can still revoke + permissions at any time by going to the system's <strong>Settings</strong> + app and choosing <strong>Apps ></strong> <i>app_name</i> <strong>> + Permissions</strong>. Because users can revoke these permissions at will, + the app should continue to check for permissions at run + time and request them if necessary. </li> <li>If the app requests permissions in the manifest that fall under {@link android.content.pm.PermissionInfo#PROTECTION_SIGNATURE PROTECTION_SIGNATURE}, and the app is signed with the same certificate as the app that declared those permissions, the system grants the requesting app those permissions on - installation. - </li> + installation. Apps cannot request signature permissions at runtime.</li> </ul> -<p> - In both cases, the user can still revoke permissions at any time by going to - the system's <strong>Settings</strong> screen and choosing <strong>Apps - ></strong> <i>app_name</i> <strong>> Permissions</strong>. The app - should continue to check for permissions at run time and request them if - necessary. -</p> - <h3 id="compatibility"> Forwards and backwards compatibility </h3> @@ -545,8 +568,54 @@ page.image=images/permissions_check.png </td> </tr> + <tr> + <td> + <code>android.permission-group.STORAGE</code> + </td> + <td> + <ul> + <li> + <code>android.permission.READ_EXTERNAL_STORAGE</code> + </li> + <li> + <code>android.permission.WRITE_EXTERNAL_STORAGE</code> + </li> + </ul> + </td> + </tr> + </table> +<h4 id="explain-need">Explain why the app needs permissions</h4> + +<p> + In some circumstances, you might want to help the user understand why your + app needs a permission. For example, if a user launches a photography app, + the user probably won't be surprised that the app asks for permission to use + the camera. But if the user turns down that permission request, then launches + the photography app again, that might indicate that the user needs some help + understanding why the permission is needed. +</p> + +<p> + To help find the situations where you need to provide extra explanation, the + system provides the + <code>Activity.shouldShowRequestPermissionRationale(String)</code> + method. This + method returns <code>true</code> if the app has requested this permission + previously and the user denied the request. + That indicates that you should probably explain to the + user why you need the permission. +</p> + +<p> + If the user turned down the permission request in the + past and chose the <em>Don't ask again</em> option in the permission request system + dialog, this method returns <code>false</code>. The method also returns + <code>false</code> if the device policy prohibits the app from having that + permission. +</p> + <h4 id="request-permissions">Request permissions if necessary</h4> <p>If the app doesn't already have the permission it needs, the app calls the @@ -564,6 +633,13 @@ page.image=images/permissions_check.png <pre> if (checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { + + // Should we show an explanation? + if (shouldShowRequestPermissionRationale( + Manifest.permission.READ_CONTACTS)) { + // Explain to the user why we need to read the contacts + } + requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); @@ -612,11 +688,10 @@ public void onRequestPermissionsResult(int requestCode, } </pre> - <p>If the user grants a permission, the system gives the app all permissions - that the app manifest lists for that functional area. If the user denies the - request, you should take appropriate action. For example, you might disable - any menu actions that depend on this permission. - </li> +<p> + If the user denies a permission request, your app should take appropriate + action. For example, your app might show a dialog explaining why it could not + perform the user's original request. </p> <p> @@ -631,7 +706,6 @@ public void onRequestPermissionsResult(int requestCode, <h2 id="testing">Testing Runtime Permissions</h2> - <p> If your app targets the M Developer Preview, you must test that it handles permissions properly. You cannot assume that your app has any @@ -706,7 +780,7 @@ $ adb pm grant com.example.myapp android.permission.RECORD_AUDIO $ adb pm revoke <package_name> <permission_name> </pre> -<h2 id="best-practices">Best Practices</h2> +<h2 id="best-practices">Best Practices and Usage Notes</h2> <p> The new permissions model gives users a smoother experience, and makes it @@ -794,3 +868,154 @@ $ adb pm revoke <package_name> <permission_name> tutorial, so you still need to check for and request permissions during the app's normal operation. </p> + +<h3 id="normal">Normal Permissions</h3> + +<p> + Many permissions are designated as {@link + android.content.pm.PermissionInfo#PROTECTION_NORMAL PROTECTION_NORMAL}, + which indicates that + there's no great risk to the user's privacy or security in letting apps have + those permissions. For example, users would reasonably want to know whether + an app can read their contact information, so users have to grant this + permission explicitly. By contrast, there's no great risk in allowing an app + to vibrate the device, so that permission is designated as <em>normal.</em> +</p> + +<p> + If an app declares in its + manifest that it needs a normal permission, the system automatically grants + the app + that permission at install time. The system does not prompt the user + to grant normal + permissions, and users cannot revoke these permissions. +</p> + +<p> + If your app declares that it needs normal permissions, the app does not need to + call <code>Activity.checkSelfPermission()</code> or + <code>Activity.requestPermissions()</code> for + those permissions. Since you declared the permissions in the manifest, you + can be sure your app was granted those permissions at install time. +</p> + +<p>Currently, the following permissions are classified as {@link + android.content.pm.PermissionInfo#PROTECTION_NORMAL PROTECTION_NORMAL}:</p> + +<ul> + <li> + <code>android.permission.WRITE_USER_DICTIONARY</code> + </li> + + <li> + <code>com.android.alarm.permission.SET_ALARM</code> + </li> + + <li> + <code>android.permission.ACCESS_LOCATION_EXTRA_COMMANDS</code> + </li> + + <li> + <code>android.permission.ACCESS_NETWORK_STATE</code> + </li> + + <li> + <code>android.permission.ACCESS_WIFI_STATE</code> + </li> + + <li> + <code>android.permission.ACCESS_WIMAX_STATE</code> + </li> + + <li> + <code>android.permission.GET_ACCOUNTS</code> + </li> + + <li> + <code>android.permission.VIBRATE</code> + </li> + + <li> + <code>android.permission.FLASHLIGHT</code> + </li> + + <li> + <code>android.permission.WAKE_LOCK</code> + </li> + + <li> + <code>android.permission.TRANSMIT_IR</code> + </li> + + <li> + <code>android.permission.MODIFY_AUDIO_SETTINGS</code> + </li> + + <li> + <code>android.permission.READ_EXTERNAL_STORAGE</code> + </li> + + <li> + <code>android.permission.REORDER_TASKS</code> + </li> + + <li> + <code>android.permission.KILL_BACKGROUND_PROCESSES</code> + </li> + + <li> + <code>android.permission.SET_WALLPAPER</code> + </li> + + <li> + <code>android.permission.SET_WALLPAPER_HINTS</code> + </li> + + <li> + <code>android.permission.SET_TIME_ZONE</code> + </li> + + <li> + <code>android.permission.EXPAND_STATUS_BAR</code> + </li> + + <li> + <code>android.permission.READ_SYNC_SETTINGS</code> + </li> + + <li> + <code>android.permission.WRITE_SYNC_SETTINGS</code> + </li> + + <li> + <code>android.permission.READ_SYNC_STATS</code> + </li> + + <li> + <code>android.permission.WRITE_SETTINGS</code> + </li> + + <li> + <code>android.permission.PERSISTENT_ACTIVITY</code> + </li> + + <li> + <code>android.permission.GET_PACKAGE_SIZE</code> + </li> + + <li> + <code>android.permission.RECEIVE_BOOT_COMPLETED</code> + </li> + + <li> + <code>android.permission.BROADCAST_STICKY</code> + </li> + + <li> + <code>android.permission.SUBSCRIBED_FEEDS_READ</code> + </li> + + <li> + <code>android.permission.CHANGE_NETWORK_STATE</code> + </li> +</ul> diff --git a/docs/html/preview/preview_toc.cs b/docs/html/preview/preview_toc.cs index d0aa55f..6ef75a5 100644 --- a/docs/html/preview/preview_toc.cs +++ b/docs/html/preview/preview_toc.cs @@ -1,10 +1,18 @@ <ul id="nav"> <li class="nav-section"> - <div class="nav-section-header empty"><a href="<?cs var:toroot ?>preview/overview.html"> - Program Overview</a></div> + <div class="nav-section-header empty"><a href="<?cs var:toroot ?>preview/overview.html" + es-lang="Información general del programa" + ja-lang="プログラム概要" + ko-lang="프로그램 개요" + pt-br-lang="Visão geral do programa" + ru-lang="Обзор программы" + zh-cn-lang="计划概览" + zh-tw-lang="程式總覽">Program Overview + </a></div> </li> + <li class="nav-section"> <div class="nav-section-header empty"><a href="<?cs var:toroot ?>preview/download.html"> Downloads</a></div> @@ -25,11 +33,25 @@ </li> <li class="nav-section"> - <div class="nav-section-header"><a href="<?cs var:toroot ?>preview/api-overview.html"> - API Overview</a></div> + <div class="nav-section-header"><a href="<?cs var:toroot ?>preview/api-overview.html" + es-lang="Información general de la API" + ja-lang="API の概要" + ko-lang="API 개요" + pt-br-lang="Visão geral da API" + ru-lang="Обзор API-интерфейсов" + zh-cn-lang="API 概览" + zh-tw-lang="API 總覽">API Overview + </a></div> <ul> - <li><a href="<?cs var:toroot ?>preview/features/runtime-permissions.html"> - Permissions</a></li> + <li><a href="<?cs var:toroot ?>preview/features/runtime-permissions.html" + es-lang="Permisos" + ja-lang="パーミッション" + ko-lang="권한" + pt-br-lang="Permissões" + ru-lang="Разрешения" + zh-cn-lang="权限" + zh-tw-lang="權限">Permissions + </a></li> <li><a href="<?cs var:toroot ?>preview/features/app-linking.html"> App Links</a></li> <li><a href="<?cs var:toroot ?>preview/backup/index.html"> @@ -38,8 +60,15 @@ </li> <li class="nav-section"> - <div class="nav-section-header empty"><a href="<?cs var:toroot ?>preview/behavior-changes.html"> - Behavior Changes</a></div> + <div class="nav-section-header empty"><a href="<?cs var:toroot ?>preview/behavior-changes.html" + es-lang="Cambios en los comportamientos" + ja-lang="動作の変更点" + ko-lang="동작 변경" + pt-br-lang="Mudanças de comportamento" + ru-lang="Изменения в работе" + zh-cn-lang="行为变更" + zh-tw-lang="行為變更">Behavior Changes + </a></div> </li> <li class="nav-section"> <div class="nav-section-header empty"><a href="<?cs var:toroot ?>preview/samples.html"> diff --git a/docs/html/sdk/installing/installing-adt.jd b/docs/html/sdk/installing/installing-adt.jd index 5559d1a..b89c068 100644 --- a/docs/html/sdk/installing/installing-adt.jd +++ b/docs/html/sdk/installing/installing-adt.jd @@ -7,6 +7,14 @@ adt.zip.checksum=f64b7e50c84799f41c642218c35f1bbe @jd:body +<p class="caution"> + <strong>Important:</strong> Support for the Android Developer Tools (ADT) in Eclipse is ending, + per our <a href= + "http://android-developers.blogspot.com/2015/06/an-update-on-eclipse-android-developer.html" + class="external-link">announcement</a>. You should migrate your app development projects to + Android Studio as soon as possible. For more information on transitioning to Android Studio, see + <a href="{@docRoot}sdk/installing/migrate.html">Migrating to Android Studio</a>. +</p> <p>Android offers a custom plugin for the Eclipse IDE, called Android Development Tools (ADT). This plugin provides a powerful, integrated @@ -15,15 +23,6 @@ of Eclipse to let you quickly set up new Android projects, build an app UI, debug your app, and export signed (or unsigned) app packages (APKs) for distribution. </p> -<p class="note"><strong>Note:</strong> -If you have been using Eclipse with ADT, be aware that <a -href="{@docRoot}tools/studio/index.html">Android Studio</a> is now the official IDE -for Android, so you should migrate to Android Studio to receive all the -latest IDE updates. For help moving projects, -see <a href="/sdk/installing/migrate.html">Migrating to Android -Studio</a>.</p> - - <p>You should install the ADT plugin only if you already have an Eclipse installation that you want to continue using. Your existing Eclipse installation must meet these requirements:</p> diff --git a/docs/html/sdk/installing/migrate.jd b/docs/html/sdk/installing/migrate.jd index 345e89a..6dedad6 100644 --- a/docs/html/sdk/installing/migrate.jd +++ b/docs/html/sdk/installing/migrate.jd @@ -4,53 +4,264 @@ page.title=Migrating to Android Studio <div id="qv-wrapper"> <div id="qv"> + + +<h2>In this document</h2> +<ol> + <li><a href="#overview">Migration Overview</a></li> + <li><a href="#prerequisites">Migration Prerequisites</a></li> + <li><a href="#migrate">Importing Projects to Android Studio</a></li> + <li><a href="#post-migration">Validating imported projects</a></li> +</ol> + + <h2>See also</h2> <ul> + <li><a href="{@docRoot}tools/studio/eclipse-transition-guide.html"> + Transition Guide for Eclipse ADT</a></li> <li><a href="http://confluence.jetbrains.com/display/IntelliJIDEA/FAQ+on+Migrating+to+IntelliJ+IDEA" - class="external-link">IntelliJ FAQ on migrating to IntelliJ IDEA</a></li> - <li><a href="http://confluence.jetbrains.com/display/IntelliJIDEA/Working+in+Eclipse+Compatibility+Mode" class="external-link" - >Eclipse Compatibility Mode</a></li> - <li><a href="http://confluence.jetbrains.com/display/IntelliJIDEA/FAQ+on+Migrating+to+IntelliJ+IDEA" class="external-link" - >FAQ on Migrating</a></li> + class="external-link">IntelliJ FAQ on migrating to IntelliJ IDEA</a></li> + <li><a href="http://confluence.jetbrains.com/display/IntelliJIDEA/IntelliJ+IDEA+for+Eclipse+Users" + class="external-link">IntelliJ IDEA for Eclipse users</a></li> + <li><a href="{@docRoot}tools/studio/index.html">Android Studio Overview</a></li> </ul> </div> </div> -<p>If you have been using <a href="{@docRoot}tools/help/adt.html">Eclipse with ADT</a>, be aware -that <a href="{@docRoot}tools/studio/index.html">Android Studio</a> is now the official IDE for -Android, so you should migrate to Android Studio to receive all the latest IDE updates.</p> +<p>Migrating from Eclipse ADT to Android Studio requires adapting to a new project structure, +build system, and IDE functionality. To simplify the migration process, Android Studio provides an +import tool so you can quickly transition your Eclipse ADT workspaces and Ant build scripts to +Android Studio projects and <a href="http://www.gradle.org">Gradle</a>-based build files.</p> -<p>To migrate existing Android projects, simply import them using Android Studio:</p> +<p>This document provides an overview of the migration process and walks you +through a sample import procedure. For more information about Android Studio features and the +Gradle-based build system, see <a href="{@docRoot}tools/studio/index.html">Android Studio Overview</a> +and <a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>.</p> -<ol> - <li>In Android Studio, from the main menu or the <strong>Welcome to Android Studio</strong> page, - choose <strong>File > Import Project</strong>.</li> - <li> Select the Eclipse root project directory</strong> and click <strong>OK</strong>. - <p class="note"><strong>Note:</strong> The Eclipse root directory must contain the - <code>AndroidManifest.xml</code> file. Also, the root directory must contain either the - <code>.project</code> and <strong>.classpath</strong> files from Eclipse or the - <code>res/</code> and <code>src/</code> directories.</p> + + +<h2 id="overview">Migration Overview </h2> +<p>Migrating from Eclipse to Android Studio requires that you change the structure of your +development projects, move to a new build system, and use a new user interface. Here are some of +the key changes you should be aware of as you prepare to migrate to Android Studio:</p> +<ul> + <li><strong>Project files</strong> + <p>Android Studio uses a different project structure. Each Eclipse ADT + project is called a module in Android Studio. Each instance of Android + Studio contains a project with one or more app modules. For more information see, + <a href="{@docRoot}tools/studio/eclipse-transition-guide.html#project-structure">Project + Structure</a>.</p></li> + + <li><strong>Manifest settings</strong> + <p>Several elements in the <code>AndroidManifest.xml</code> file are now properties in the + <code>defaultConfig</code> and <code>productFlavors</code> blocks in the + <code>build.gradle</code> file. These elements are still valid manifest entries and may + appear in manifests from older projects, imported projects, dependencies, and libraries. For + more information see, + <a href="{@docRoot}tools/studio/eclipse-transition-guide.html#manifest-settings">Manifest + Settings</a>.</p></li> + + <li><strong>Dependencies</strong> + <p>Library dependencies are handled differently in Android Studio, using Gradle dependency + declarations and Maven dependencies for well-known local source and binary libraries with + Maven coordinates. For more information see, + <a href="{@docRoot}tools/studio/eclipse-transition-guide.html#dependencies">Dependencies</a></p> + </li> + + <li><strong>Test code</strong> + <p>With Eclipse ADT, test code is written in separate projects and integrated through the + <code><instrumentation></code> element in your manifest file. Android Studio provides a + <code>AndroidTest</code> folder within your project so you can easily add and maintain your test + code within the same project view. JUnit tests can also be configured to run locally to reduce + testing cycles.</p></li> + + <li><strong>Gradle-based build system</strong> + <p>In place of XML-based Ant build files, Android Studio supports Gradle build files, which + use the Gradle Domain Specific Language (DSL) for ease of extensibility and customization. + The Android Studio build system also supports + <a href="{@docRoot}tools/building/configuring-gradle.html#workBuildVariants"> build variants</a>, + which are combinations of <code>productFlavor</code> and <code>buildTypes</code>, to customize + your build outputs.</p></li> + + <li><strong>User interface</strong> + <p>Android Studio provides an intuitive interface and menu options based on the + <a class="external-link" href="https://www.jetbrains.com/idea/" target="_blank">IntelliJ IDEA</a> + IDE. To become familiar with the IDE basics, such as navigation, code completion, and keyboard + shortcuts, see + <a class="external-link" href="https://www.jetbrains.com/idea/help/intellij-idea-quick-start-guide.html" + target="_blank">IntelliJ IDEA Quick Start Guide</a>.</p></li> + + <li><strong>Developer tools versioning</strong> + <p>Android Studio updates independently of the Gradle-based build system so different build + settings can be applied across different versions of command line, Android Studio, and + continuous integration builds. For more information, see + <a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>.</p> + </li> +</ul> + + + + +<h2 id="prerequisites">Migration Prerequisites</h2> +<p>Before migrating your Eclipse ADT app to Android Studio, review the following steps to make +sure your project is ready for conversion, and verify you have the tool configuration you need in +Android Studio:</p> + +<ul> + <li>In Eclipse ADT: + <ul> + <li>Make sure the Eclipse ADT root directory contains the <code>AndroidManifest.xml</code> + file. Also, the root directory must contain either the <code>.project</code> and + <code>.classpath</code> files from Eclipse or the <code>res/</code> and <code>src/</code> + directories.</li> + <li>Build your project to ensure your latest workspace and project updates are saved and + included in the import.</li> + <li>Comment out any references to Eclipse ADT workspace library files in the + <code>project.properties</code> or <code>.classpath</code> files for import. You can + add these references in the <code>build.gradle</code> file after the import. For more + information, see + <a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>.</li> + <li>It may be useful to record your workspace directory, path variables, and any actual path + maps that could be used to specify any unresolved relative paths, path variables, and + linked resource references. Android Studio allows you to manually specify any unresolved + paths during the import process.</li> + </ul> + </li> + <li>In Android Studio: + <ul> + <li>Make a note of any third-party Eclipse ADT plugins in use and check for equivalent features + in Android Studio or search for a compatible plugin in the + <a href="https://plugins.jetbrains.com/?androidstudio" class="external-link">IntelliJ Android + Studio Plugins</a> repository. Use the <strong>File > Settings > Plugins</strong> menu + option to manage plugins in Android Studio. Android Studio does not migrate any third-party + Eclipse ADT plugins.</li> + <li>If you plan to run Android Studio behind a firewall, be sure to set the proxy settings for + Android Studio and the SDK Manager. Android Studio requires an internet connection for + Setup Wizard synchronization, 3rd-party library access, access to remote repositories, + <a href="http://www.gradle.org" class="external-link">Gradle</a> + initialization and synchronization, and Android Studio version updates. For more information, + see <a href="{@docRoot}tools/studio/index.html#proxy">Proxy Settings</a>.</li> + <li>Use the <strong>File > Settings > System Settings</strong> menu option to verify the + current version and, if necessary, update Android Studio to the latest version from the + stable channel. To install Android Studio, please visit the + <a href="{@docRoot}sdk/index.html">Android Studio download page</a>.</li> + </ul> </li> - <li>Follow the steps in the import wizard. </li> + </ul> + + + +<h2 id="migrate">Importing Projects to Android Studio</h2> +<p>Android Studio provides a function for importing Eclipse ADT projects, which creates a new +Android Studio project and app modules based on your current +Eclipse ADT workspace and projects. No changes are made to your Eclipse project files. The Eclipse +ADT workspace becomes a new Android Studio project, and each Eclipse ADT project within the workspace +becomes a new Android Studio module. Each instance of Android Studio contains a project with one or +more app modules.</p> + +<p>After selecting an Eclipse ADT project to import, Android Studio creates the Android +Studio project structure and app modules, generates the new Gradle-based build files and settings, +and configures the required dependencies. The import options also allow you to enter your workspace +directory and any actual path maps to handle any unresolved relative paths, path variables, and +linked resource references.</p> + +<p>Depending on the structure of your Eclipse ADT development project, you should select specific +files for importing:</p> +<ul> +<li>For workspaces with multiple projects, select the project folder for each Eclipse ADT + project individually to import the projects into the same Android Studio project. Android + Studio combines the Eclipse ADT projects into a single Android Studio project with different app + modules for each imported project.</li> + +<li>For Eclipse ADT projects with separate test projects, select the test project folder for + import. Android Studio imports the test project and then follows the dependency chain to import + the source project and any project dependencies.</li> + + <li>If Eclipse ADT projects share dependencies within the same workspace, import each + project individually into Android Studio. Android Studio maintains the shared dependencies + across the newly created modules as part of the import process.</li> +</ul> + +<p>To import a project to Android Studio:</p> + +<ol> + <li>Start Android Studio and close any open Android Studio projects.</li> + <li>From the Android Studio menu select <strong>File > New > Import Project</strong>. + <p>Alternatively, from the <em>Welcome</em> screen, select <strong>Import project + (Eclipse ADT, Gradle, etc.)</strong>.</p></li> + <li>Select the Eclipse ADT project folder with the <code>AndroidManifest.xml</code> file + and click <strong>Ok</strong>. + <p> <img src="{@docRoot}images/tools/studio-select-project-forimport.png" alt="" /></p> + </li> + <li>Select the destination folder and click <strong>Next</strong>. + <p> <img src="{@docRoot}images/tools/studio-import-destination-dir.png" alt="" /></p></li> + <li>Select the import options and click <strong>Finish</strong>. + <p>The import process prompts to migrate any library and project dependencies to Android Studio, + and add the dependency declarations to the <code>build.gradle</code> file. The import process + also replaces any well-known source libraries, binary libraries, and JAR files that have known + Maven coordinates with Maven dependencies, so you no longer need to maintain these dependencies + manually. The import options also allow you to enter your workspace directory and any actual + path maps to handle any unresolved relative paths, path variables, and linked resource + references.</p> + <p> <img src="{@docRoot}images/tools/studio-import-options.png" alt="" /></p></li> + + <li>Android Studio imports the app and displays the project import summary. Review the summary + for details about the project restructuring and the import process. + <p> <img src="{@docRoot}images/tools/studio-import-summary.png"/></p> + </li> </ol> -<p>Android Studio imports the current dependencies, downloads libraries, and -creates an Android Studio project with the imported Eclipse project as the main module. Android -Studio also creates the required Gradle build files. </p> +<p>After importing the project from Eclipse ADT to the new Android Studio project and module +structure, each app module folder in Android Studio contains the complete source set for that +module, including the {@code src/main} and {@code src/androidTest} directories, resources, build +file, and Android manifest. Before starting app development, you should resolve any issues shown in +the project import summary to make sure the project re-structuring and import process completed +properly.</p> + + + +<h3 id="post-migration">Validating imported projects</h3> +<p>After completing the import process, use the Android Studio <strong>Build</strong> and +<strong>Run</strong> menu options to build your project and verify the output. If your project +is not building properly, check the following settings:</p> + +<ul> +<ul> + <li>Use the <strong>Android SDK</strong> button in Android Studio to launch the <a href= + "{@docRoot}tools/help/sdk-manager.html">SDK Manager</a> and verify the installed versions of SDK + tools, build tools, and platform match the settings for your Eclipse ADT project. Android Studio + inherits the SDK Manager and JDK settings from your imported Eclipse project. + </li> + <li>Use the <strong>File > Project Structure</strong> menu option to verify additional + Android Studio settings: + <ul> + <li>Under <em>SDK Location</em> verify Android Studio has access to the correct SDK and + JDK locations and versions. </li> + <li>Under <em>Project</em> verify the Gradle version, Android Plugin version, and related + repositories.</li> + <li>Under <em>Modules</em> verify the app and module settings, such as signing configuration + and library dependencies. </li> + </ul> + </li> + <li>If your project depends on another project, make sure that dependency is defined properly in + the <code>build.gradle</code> file in the app module folder.</li> +</ul> + -<p>The import process replaces any JAR files and libraries with Gradle dependencies, and replaces -source libraries and binary libraries with Maven dependencies, so you no longer need to maintain -these files manually.</p> +<p>If there still are unexpected issues when building and running your project in Android +Studio after you have checked these settings, consider modifying the Eclipse ADT project and +re-starting the import process. Importing an Eclipse ADT project to Android Studio creates a new +Android Studio project and does not impact the existing Eclipse ADT project. </p> - <p class="note"><strong>Note:</strong> If there are references to Eclipse workspace library files, - comment them out in the <code>project.properties</code> or <code>.classpath</code> files - that you imported from the Eclipse project. You can then add these files in the - <code>build.gradle</code> file. See - <a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>. </p> -<p>For more help getting started with Android Studio and the IntelliJ user experience, -<a href="{@docRoot}tools/studio/index.html">learn more about Android Studio</a> and -read <a href="http://confluence.jetbrains.com/display/IntelliJIDEA/FAQ+on+Migrating+to+IntelliJ+IDEA" - class="external-link">FAQ on Migrating to IntelliJ IDEA</a>.</p> +<p>To get started using Android Studio, review the +<a href="{@docRoot}tools/studio/index.html">Android Studio</a> features and +<a href="http://www.gradle.org">Gradle</a>-based build system to become familiar with the new +project and module structure, flexible build settings, and other advanced Android development +capabilities. For a comparison of Eclipse ADT and Android Studio features and usage, see +<a href="{@docRoot}tools/studio/eclipse-transition-guide.html">Transitioning to Android Studio from +Eclipse</a>. For specific Android Studio how-to documentation, see the pages in the +<a href="{@docRoot}tools/workflow/index.html">Workflow</a> section. +</p> diff --git a/docs/html/sdk/installing/studio-tips.jd b/docs/html/sdk/installing/studio-tips.jd index a40050f..7d37b1d 100644 --- a/docs/html/sdk/installing/studio-tips.jd +++ b/docs/html/sdk/installing/studio-tips.jd @@ -6,7 +6,7 @@ page.title=Android Studio Tips and Tricks <h2>In this document</h2> <ol> - <li><a href="#productivity-features">Productivity Features</a></li> + <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> @@ -26,7 +26,7 @@ provides some tips to help you get started with some of the most common tasks an enhancements. </p> -<h2 id="productivity-features">Productivity Features</h2> +<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. @@ -48,6 +48,18 @@ the bitmap in the debugger. </p> <p class="img-caption"><strong>Figure 1.</strong> Bitmap Rendering</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> + + <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> @@ -111,8 +123,8 @@ a class, method, or field from a library for which you do not have source file a <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>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 @@ -174,7 +186,7 @@ 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 +reference. Pressing {@code F1} with the preview image or icon selected displays resource asset details, such as the <em>dp</em> settings. </p> @@ -188,13 +200,6 @@ attribute <em>?android:textAppearanceLarge</em>, you will see the theme inherita resolved values for the various attributes that are pulled in.</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 4.</strong> Allocation Tracker</p> - <h3 id="key-commands">Keyboard Commands</h3> diff --git a/docs/html/tools/building/building-cmdline-ant.jd b/docs/html/tools/building/building-cmdline-ant.jd index 51158de..add6ca2 100644 --- a/docs/html/tools/building/building-cmdline-ant.jd +++ b/docs/html/tools/building/building-cmdline-ant.jd @@ -31,6 +31,14 @@ Emulator</a></li> </div> </div> +<p class="caution"> + <strong>Important:</strong> Support for Ant as a build tool for Android is ending, per our + <a href="http://android-developers.blogspot.com/2015/06/an-update-on-eclipse-android-developer.html" + class="external-link">announcement</a>. You should migrate your app development projects to + Android Studio and Gradle as soon as possible. For more information on transitioning to these + tools, see <a href="{@docRoot}sdk/installing/migrate.html">Migrating to Android Studio</a>. +</p> + <p>There are two ways to build your application using the Ant build script: one for testing/debugging your application — <em>debug mode</em> — and one for building your final package for release — <em>release mode</em>. Regardless of which way you build your application, diff --git a/docs/html/tools/building/configuring-gradle.jd b/docs/html/tools/building/configuring-gradle.jd index 7cca5b4..73a048b 100644 --- a/docs/html/tools/building/configuring-gradle.jd +++ b/docs/html/tools/building/configuring-gradle.jd @@ -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 diff --git a/docs/html/tools/building/manifest-merge.jd b/docs/html/tools/building/manifest-merge.jd new file mode 100644 index 0000000..54166ec --- /dev/null +++ b/docs/html/tools/building/manifest-merge.jd @@ -0,0 +1,510 @@ +page.title=Manifest Merging +@jd:body + +<div id="qv-wrapper"> +<div id="qv"> + + <h2>In this document</h2> + <ol> + <li><a href="#merge-rules">Merge Conflict Rules</a></li> + <li><a href="#markers-selectors">Merge Conflict Markers and Selectors</a></li> + <li><a href="#inject-values">Injecting Build Values into a Manifest</a></li> + <li><a href="#merge-prodflavorsGroups">Manifest Merging Across Product Flavor Groups</a></li> + <li><a href="#implicit-permissions">Implicit Permissions</a></li> + <li><a href="#merge-errors">Handling Manifest Merge Build Errors</a></li> + </ol> + + <h2>See also</h2> + <ol> + <li><a href="{@docRoot}sdk/installing/studio-build.html">Build System Overview</a></li> + <li><a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a> </li> + </ol> + +</div> +</div> + + +<p>With Android Studio and <a href="http://www.gradle.org">Gradle</a>-based builds, each app can +contain manifest files in multiple locations, such as the <code>src/main/</code> folder for +the <code>productFlavor</code>, libraries, Android ARchive (AAR) bundles of Android Library +projects, and dependencies. During the build process, manifest merging combines the settings from +the various <code>AndroidManifest.xml</code> files included in your app into a single, generated APK +manifest file for app packaging and distribution. Manifest settings are merged based on the manifest +priority, determined by the manifest's file location. Building your app merges the +manifest elements, attributes, and sub-elements from these manifests for the specified +<a href="{@docRoot}tools/building/configuring-gradle.html#workBuildVariants">build variant</a>.</p> + + +<h2 id="merge-rules">Merge Conflict Rules</h2> +<p>Merge conflicts occur when merged manifests contain the same manifest element but with a +different attribute value that does not resolve based on the default merge conflict rules. +<a href="#markers-selectors">Conflict markers and selectors</a> can also define custom merge rules, +such as allowing an imported library to have a <code>minSdkVersion</code> higher than the +version defined in the other higher priority manifests. </p> + +<p>The manifest merge priority determines which manifest settings are retained in merge conflicts, +with the settings in higher priority manifest overwriting those in lower priority manifests. +The following list details which manifest settings are are the highest priority during the merge +process:</p> + +<ul> + <li>Highest priority: <code>buildType</code> manifest settings </li> + <li>Higher priority: <code>productFlavor</code> manifest settings </li> + <li>Medium priority: Manifests in the <code>src/main/</code> directory of an app project</li> + <li>Low priority: Dependency and library manifest settings </li> +</ul> + +<p>Manifest merge conflicts are resolved at the XML node and +attribute levels based on the following merge rules. </p> + +<table> + <tr> + <th scope="col">High Priority Element</th> + <th scope="col">Low Priority Element</th> + <th scope="col">Manifest Merge Result</th> + </tr> + <tr> + <td rowspan="3">no attribute</td> + <td>no attribute</td> + <td>no attribute</td> + </tr> + <tr> + + <td>attribute set to default</td> + <td>default attribute</td> + </tr> + <tr> + + <td>attribute set to non-default </td> + <td>low priority attribute</td> + </tr> + <tr> + <td>attribute set to default</td> + <td rowspan="2">no attribute</td> + <td>default attribute</td> + </tr> + <tr> + <td>attribute set to non-default </td> + + <td>high priority attribute</td> + </tr> + <tr> + <td>attribute set to default</td> + <td>attribute set to default</td> + <td>default attribute</td> + </tr> + <tr> + <td>attribute set to default</td> + <td>attribute set to non-default </td> + <td>low priority attribute</td> + </tr> + <tr> + <td>attribute set to non-default</td> + <td>attribute set to default</td> + <td>high priority attribute</td> + </tr> + <tr> + <td>attribute set to non-default</td> + <td>attribute set to non-default </td> + <td>Merge if settings match, otherwise causes conflict error.</td> + </tr> + </table> + + + +<p>Exceptions to the manifest merge rules: </p> + +<ul> + <li>The <code>uses-feature android:required;</code> and + <code>uses-library android:required</code> elements default to <code>true</code> and use + an <em>OR</em> merge so that any required feature or library is included in the generated APK. </li> + + <li>If not declared, the + <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><code><uses-sdk></code></a> + elements, <code>minSdkVersion</code> and + <code>targetSdkVersion</code>, default to a value of 1. When + merge conflicts occur, the value in the higher priority manifest version is used.</li> + + <li>Importing a library with a <code>minSdkVersion</code> value higher than the app's + <code>src/main/</code> manifest manifest generates an error unless + the <code>overrideLibrary</code> conflict marker is used. + + <p class="note"><strong>Note:</strong> If not explicitly declared, the <code>targetSdkVersion</code> + defaults to the <code>minSdkVersion</code> value. When no <code><uses-sdk></code> element is + present in any manifest or the <code>build.gradle</code> file, the + <code>minSdkVersion</code> defaults to 1.</p> </li> + + <li>When importing a library with a <code>targetSdkVersion</code> value lower than the app's + <code>src/main/</code> manifest, the manifest merge + process explicitly grants permissions and ensures that the imported library functions properly. </li> + + <li>The <code>manifest</code> element only merges with child manifest elements. </li> + + <li>The <code>intent-filter</code> element is never changed and is always added to the common + parent node in the merged manifest. </li> +</ul> + +<p class="caution"><strong>Important:</strong> After the manifests are merged, the build process +overrides the final manifest settings with any settings that are also in the +<code>build.gradle</code> file. For more details, see +<a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>. </p> + + + +<h2 id="markers-selectors">Merge Conflict Markers and Selectors</h2> +<p>Manifest markers and selectors override the default merge rules through +specific conflict resolutions. For example, use a conflict marker to +merge a library manifest with a higher <code>minSdkVersion</code> value than the higher priority +manifest, or to merge manifests with the same activity but different <code>android:theme</code> +values. </p> + +<h3 id="conflict-markers">Merge Conflict Markers</h3> +<p>A merge conflict marker is a special attribute in the Android tools namespace that defines a +specific merge conflict resolution. Create a conflict marker to avoid a merge conflict error for +conflicts not resolved by the default merge rules. Supported merge conflict markers include:</p> + +<dl> + <dt><code>merge</code></dt> + <dd>Merges attributes when there are no conflicts with the merge rules. The default merge + action.</dd> + <dt><code>replace</code></dt> + <dd>Replaces attributes in the lower priority manifest with those from the higher priority + manifest.</dd> + <dt><code>strict</code></dt> + <dd>Sets the merge policy level so that merged elements with same attributes, but different + values generate a build failure, unless resolved through the conflict rules.</dd> + <dt><code>merge-only</code></dt> + <dd>Allows merge actions for only lower priority attributes.</dd> + <dt><code>remove</code></dt> + <dd>Removes the specified lower priority element from the merged manifest.</dd> + <dt><code>remove-All</code></dt> + <dd>Removes all lower priority elements of the same node type from the merged manifest.</dd> +</dl> + + +<p>By default, the manifest merge process applies the <code>merge</code> conflict marker to +the node level. All declared manifest attributes default to a <code>strict</code> +merging policy. </p> + +<p>To set a merge conflict marker, first declare the namespace in the +<code>AndroidManifest.xml</code> file. Then, enter the merge conflict marker in the manifest to +specify a custom merge conflict action. This example inserts the <code>replace</code> marker to +set a replace action to resolve conflicts between the <code>android:icon</code> and +<code>android:label</code> manifest elements. </p> + +<pre> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.tests.flavorlib.app" + xmlns:tools="http://schemas.android.com/tools"> + + <application + android:icon="@drawable/icon" + android:label="@string/app_name" + tools:replace="icon, label"> + ... + +</manifest> + +</pre> + + +<h4>Marker attributes</h4> +<p>Conflict markers use <code>tools:node</code> and <code>tools:attr</code> attributes to +restrict merge actions at the XML node or attribute level. </p> + +<p>The <code>tools:attr</code> markers use only the <code>restrict</code>, <code>remove</code>, and +<code>replace</code> merge actions. Multiple <code>tools:attr</code> marker values can be applied +to a specific element. For example, use <code>tools:replace="icon, label, theme"</code> to replace +lower priority <code>icon</code>, <code>label</code>, and <code>theme</code> attributes. </p> + + +<h4>Merge conflict marker for imported libraries</h4> +<p>The <code>overrideLibrary</code> conflict marker applies to the <code><uses-sdk></code> +manifest declaration and is used to import a library even though the library's +<code><uses-sdk></code> values, such as <code>minSdkVersion</code> +are set to different values than those in the other higher priority manifests. </p> + +<p>Without this marker, library manifest merge conflicts from the +<code><uses-sdk></code> values cause the merge process to fail.</p> + +<p>This example applies the <code>overrideLibrary</code> conflict marker to resolve the merge +conflict between <code>minSdkVersion</code> values in the <code>src/main/</code> manifest and an +imported library manifest. + + +<p><code>src/main/</code> manifest: </p> +<pre> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.example.app" + xmlns:tools="http://schemas.android.com/tools"> + ... + <uses-sdk android:targetSdkVersion="22" android:minSdkVersion="2" + tools:overrideLibrary="com.example.lib1, com.example.lib2"/> + ... +</pre> + +<p>Library manifest: </p> + +<pre> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.lib1"> + ... + <uses-sdk android:minSdkVersion="4" /> + ... + </manifest> +</pre> + +<p class="note"><strong>Note:</strong> The default merge process does not allow importing a library +with a higher <code>minSdkVersion</code> than the app's <code>src/main/</code> manifest unless +the <code>overrideLibrary</code> conflict marker is used. </p> + + + +<h3 id="marker-selectors">Marker Selectors</h3> +<p>Marker selectors limit a merge action to a specific lower priority manifest. For example, a +marker selector can be used to remove a permission from only one library, while allowing the +same permission from other libraries.</p> + +<p>This example uses the <code>tools:node</code> marker to remove the <code>permisionOne</code> +attribute, while the <code>tools:selector</code> selector specifies the specific library as +<em>com.example.lib1</em>. The <code>permisionOne</code> permission is filtered from only the +<code>lib1</code> library manifests. </p> + +<pre> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.example.app" + xmlns:tools="http://schemas.android.com/tools"> + ... + <permission + android:name="permissionOne" + tools:node="remove" + tools:selector="com.example.lib1"> + ... +</pre> + + + +<h2 id="inject-values">Injecting Build Values into a Manifest</h2> +<p>Manifest merging can also be configured to use manifest placeholders to inject +property values from the <code>build.gradle</code> file into the manifest attributes. </p> + +<p>Manifest placeholders use the syntax <code>${name}</code> for attribute values, where +<code>name</code> is the injected <code>build.gradle</code> property. The <code>build.gradle</code> +file uses the <code>manifestPlaceholders</code> property to define the placeholder values. </p> + +<p class="note"><strong>Note:</strong> Unresolved placeholder names in apps cause build failures. +Unresolved placeholder names in libraries generate warnings and need to be resolved when importing +the library into an app.</p> + +<p>This example shows the manifest placeholder <code>${applicationId}</code> used to inject the +<code>build.gradle</code> <code>applicationId</code> property value in to <code>android:name</code> +attribute value. </p> + +<p class="note"><strong>Note:</strong> Android Studio provides a default +<code>${applicationId}</code> placeholder for the <code>build.gradle</code> +<code>applicationId</code> value that is not shown in the build file.</p> + + +<p>Manifest entry:</p> + +<pre> + +<activity +android:name=".Main"> + <intent-filter> + <action android:name="${applicationId}.foo"> + </action> +</intent-filter> +</activity> + +</pre> + + +<p>Gradle build file:</p> + +<pre> +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + productFlavors { + flavor1 { + applicationId = "com.mycompany.myapplication.productFlavor1" + } +} + +</pre> + +<p>Merged manifest value: </p> + +<pre> +<action android:name="com.mycompany.myapplication.productFlavor1.foo"> +</pre> + + +<p>The manifest placeholder syntax and build file <code>manifestPlaceholders</code> +property can be used to inject other manifest values. For properties other than the +<code>applicationId</code>, the <code>manifestPlaceholders</code> property is explicitly declared +in the <code>build.gradle</code> file. This example shows the manifest placeholder for injecting +<code>activityLabel</code> values.</p> + +<p>Gradle build file: </p> + +<pre> +android { + defaultConfig { + manifestPlaceholders = [ activityLabel:"defaultName"] + } + productFlavors { + free { + } + pro { + manifestPlaceholders = [ activityLabel:"proName" ] + } + } + +</pre> + +<p>Placeholder in the manifest file: </p> + +<pre> +<activity android:name=".MainActivity" android:label="${activityLabel}" > +</pre> + +<p class="note"><strong>Note:</strong> The placeholder value supports partial value injection, +for example <code>android:authority="com.acme.${localApplicationId}.foo"</code>. </p> + + + +<h2 id="merge-prodflavorsGroups">Manifest Merging Across Product Flavor Groups</h2> + +<p>When using the <code>GroupableProductFlavor</code> property, the manifest merge +priority of any manifests in the product flavor groups follows the order in which the +product flavor groups are listed in the build file. The manifest merge process creates a single +merged manifest for the product flavor groups based on the configured build variant. </p> + +<p>For example, if a build variant references the product flavors <code>x86</code>, +<code>mdpi</code>, <code>21</code>, and <code>paid</code> from the respective product flavor +groups <code>ABI</code>, <code>Density</code>, <code>API</code>, and <code>Prod</code>, listed +in this order in the <code>build.gradle</code> file, then the manifest merge process merges the +manifests in this priority order, which follows how the product flavors are listed in the build +file.</p> + +<p>To illustrate this example, the following table shows how the product flavors are listed for +each product flavor group. This combination of product flavors and groups defines the +build variant. </p> +<table> + <tr> + <th scope="col">Product Flavor Group</th> + <th scope="col">Product Flavor</th> + <tr> + <td>ABI</td> + <td>x86</td> + </tr> + <tr> + <td>density</td> + <td>mdpi</td> + </tr> + <tr> + <td>API</td> + <td>22</td> + </tr> + <tr> + <td>prod</td> + <td>paid</td> + </tr> +</table> + +<p>Manifest merge order:</p> + + <ul> + <li>prod-paid AndroidManifest.xml (lowest priority) merges into API-22 AndroidManifest.xml</li> + <li>API-22 AndroidManifest.xml merges into density-mpi AndroidManifest.xml</li> + <li>density-mpi AndroidManifest.xml merges into ABI-x86 AndroidManifest.xml (highest priority)</li> + </ul> + + +<h2 id="implicit-permissions">Implicit Permissions</h2> +<p>Importing a library that targets an Android runtime with implicitly +granted permissions may automatically add the permissions to the resulting merged manifest. +For example, if an application with a <code>targetSdkVersion</code> of 16 imports a library with a +<code>targetSdkVersion</code> of 2, Android Studio adds the <code>WRITE_EXTERNAL_STORAGE</code> +permission to ensure permission compatibility across the SDK versions. + +<p class="note"><strong>Note:</strong> More recent Android releases replace implicit +permissions with permission declarations.</p> + + +This table lists the importing library versions and the declared permissions. +</p> + + <table> + <tr> + <th>Importing this library version</th> + <th>Declares this permission in the manifest </th> + </tr> + <tr> + <td><code>targetSdkVersion</code> < 2 </td> + <td><code>WRITE_EXTERNAL_STORAGE</code> </td> + </tr> + <tr> + <td><code>targetSdkVersion</code> < 4 </td> + <td><code>WRITE_EXTERNAL_STORAGE</code>, <code>READ_PHONE_STATE</code> </td> + </tr> + <tr> + <td>Declared <code>WRITE_EXTERNAL_STORAGE</code></td> + <td><code>READ_EXTERNAL_STORAGE</code></td> + </tr> + <tr> + <td><code>targetSdkVersion</code> < 16 and using the <code>READ_CONTACTS</code> + permission</td> + <td><code>READ_CALL_LOG</code></td> + </tr> + <tr> + <td><code>targetSdkVersion</code> < 16 and using the <code>WRITE_CONTACTS</code> + permission</td> + <td><code>WRITE_CALL_LOG</code></td> + </tr> + </table> + + + +<h2 id="merge-errors">Handling Manifest Merge Build Errors</h2> +<p>During the build process, the manifest merge process stores a record of each merge transaction +in the <code>manifest-merger-<productFlavor>-report.txt</code> file in the module +<code>build/outputs/logs</code> folder. A different log file is generated for each of the +module's build variants. </p> + +<p>When a manifest merge build error occurs, the merge process records the error message +describing the merge conflict in the log file. For example, the +<code>android:screenOrientation</code> merge conflict between the following manifests causes +a build error. </p> + +<p>Higher priority manifest declaration: </p> + +<pre> +<activity + android:name="com.foo.bar.ActivityOne" + android:screenOrientation="portrait" + android:theme="@theme1"/> +</pre> + +<p>Lower priority manifest declaration: </p> + +<pre> +<activity + android:name="com.foo.bar.ActivityOne" + android:screenOrientation="landscape"/> +</pre> + +<p>Error log:</p> + +<pre> +/project/app/src/main/AndroidManifest.xml:3:9 Error: + Attribute activity@screenOrientation value=(portrait) from AndroidManifest.xml:3:9 + is also present at flavorlib:lib1:unspecified:3:18 value=(landscape) + Suggestion: add 'tools:replace="icon"' to <activity> element at AndroidManifest.xml:1:5 to override +</pre> + + diff --git a/docs/html/tools/help/adt.jd b/docs/html/tools/help/adt.jd index 8abe1b4..0fac62d 100644 --- a/docs/html/tools/help/adt.jd +++ b/docs/html/tools/help/adt.jd @@ -30,20 +30,21 @@ page.tags=adt </div> </div> - <p>ADT (Android Developer Tools) is a plugin for Eclipse that provides a suite of +<p class="caution"> + <strong>Important:</strong> Support for the Android Developer Tools (ADT) in Eclipse is ending, + per our <a href= + "http://android-developers.blogspot.com/2015/06/an-update-on-eclipse-android-developer.html" + class="external-link">announcement</a>. You should migrate your app development projects to + Android Studio as soon as possible. For more information on transitioning to Android Studio, see + <a href="{@docRoot}sdk/installing/migrate.html">Migrating to Android Studio</a>. +</p> + + <p>Android Developer Tools (ADT) is a plugin for Eclipse that provides a suite of tools that are integrated with the Eclipse IDE. It offers you access to many features that help you develop Android applications. ADT provides GUI access to many of the command line SDK tools as well as a UI design tool for rapid prototyping, designing, and building of your application's user interface.</p> -<p class="note"><strong>Note:</strong> -If you have been using Eclipse with ADT, be aware that <a -href="{@docRoot}tools/studio/index.html">Android Studio</a> is now the official IDE -for Android, so you should migrate to Android Studio to receive all the -latest IDE updates. For help moving projects, -see <a href="/sdk/installing/migrate.html">Migrating to Android -Studio</a>.</p> - <p>If you still wish to use the ADT plugin for Eclipse, see <a href="{@docRoot}sdk/installing/installing-adt.html">Installing Eclipse Plugin.</a> </p> diff --git a/docs/html/tools/studio/eclipse-transition-guide.jd b/docs/html/tools/studio/eclipse-transition-guide.jd new file mode 100644 index 0000000..aaacbe3 --- /dev/null +++ b/docs/html/tools/studio/eclipse-transition-guide.jd @@ -0,0 +1,773 @@ +page.title=Transition Guide for Eclipse ADT +@jd:body + + +<div id="qv-wrapper"> +<div id="qv"> + +<h2>In this document</h2> + <ol> + <li><a href="#project-structure">Project Structure</a></li> + <li><a href="#manifest-settings">Manifest Settings</a></li> + <li><a href="#dependencies">Dependencies</a></li> + <li><a href="#build-process">Gradle-based Build Process</a></li> + <li><a href="#debug-inspect">Debugging and Code Inspections</a></li> + <li><a href="#resource-optimization">Resource Optimization</a></li> + <li><a href="#signing">App Signing</a></li> + <li><a href="#support-lib">Android Support Repository and Google Play services Repository</a></li> + <li><a href="#app-package">App Packaging</a></li> + <li><a href="#software-updates">Software Updates </a></li> + <li><a href="#version-control">Version Control</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> + <li><a class="external-link" + href="https://confluence.jetbrains.com/display/IntelliJIDEA/IntelliJ+IDEA+for+Eclipse+Users"> + IntelliJ IntelliJ for Eclipse Users</a></li> + <li><a href="{@docRoot}tools/studio/index.html">Android Studio Overview</a> </li> + </ol> + +</div> +</div> + + +<p>This document describes the differences between Eclipse ADT and Android Studio, including project + structure, build system, debugging, and application packaging. This guide is intended to help you + transition to using Android Studio as your development environment.</p> + +<h2 id="project-structure">Project Structure </h2> +<p>Eclipse provides workspaces as a common area for grouping related projects, configurations, and +settings. In Android Studio, each instance of Android Studio contains a top-level project with one +or more app modules. Each app module folder contains the equivalent to an Eclipse +project, the complete source sets for that module, including {@code src/main} and +{@code src/androidTest} directories, resources, build file, and the Android manifest. In general, +to update and build your app you modify the files under each module's +{@code src/main} directory for source code updates, the <code>gradle.build</code> file for +build specification, and the files under {@code src/androidTest} directory for test case creation. </p> + +<p>You can also customize the view of the project files in Android Studio 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>The following table shows the general mapping of the Eclipse ADT project structure and file +locations to Android Studio.</p> + +<p class="table-caption" id="table-project-structure-mapping"> + <strong>Table 1.</strong> Project structure mapping.</p> + +<table> + <tr> + <th scope="col">Eclipse ADT</th> + <th scope="col">Android Studio</th> + </tr> + + <tr> + <td>Workspace </td> + <td>Project </td> + </tr> + + <tr> + <td>Project </td> + <td>Module </td> + </tr> + + <tr> + <td>Project-specific JRE </td> + <td>Module JDK </td> + </tr> + + <tr> + <td>Classpath variable </td> + <td>Path variable</td> + </tr> + + <tr> + <td>Project dependency</td> + <td>Module dependency</td> + </tr> + + <tr> + <td>Library Module</td> + <td>Library </td> + </tr> + + <tr> + <td><code>AndroidManifest.xml</code></td> + <td><code>app/src/main/AndroidManifest.xml</code> </td> + </tr> + <tr> + <td><code>assets/</code></td> + <td><code>app/src/main/assets</code> </td> + </tr> + <tr> + <td><code>res/</code></td> + <td><code>app/src/main/res/</code> </td> + </tr> + <tr> + <td><code>src/</code></td> + <td><code>app/src/main/java/ </code> </td> + </tr> + <tr> + <td><code>tests/src/</code></td> + <td><code>app/src/androidTest/java/</code> </td> + </tr> + + </table> + + + +<p>Table 2 shows Eclipse ADT and Android Studio project views. </p> + +<p class="table-caption" id="table2"> + <strong>Table 2.</strong> Comparing project views.</p> +<table> + <tbody><tr> + <th>Eclipse ADT</th> + <th>Android Studio Project View</th> + <th>Android Studio Android View</th> + </tr> + <tr> + <td><img src="{@docRoot}images/tools/eclipse-notepad-pre-import--structure.png"/> </td> + <td><img src="{@docRoot}images/tools/studio-import-project-structure-project.png"/> </td> + <td><img src="{@docRoot}images/tools/studio-import-project-structure-android.png"/> </td> + </tr> + </tbody> +</table> + + +<p class="note"><strong>Note:</strong> Multiple instances of Android Studio can be used to develop +independent projects. </p> + + + + +<h2 id="manifest-settings">Manifest Settings</h2> +<p>Android Studio and <a href="http://www.gradle.org">Gradle</a>-based builds support +<a href="{@docRoot}tools/building/configuring-gradle.html#workBuildVariants"> build variants</a>, +which are combinations of <code>productFlavor</code> and <code>buildTypes</code>, to customize +your build outputs. To support these custom builds, several elements in the +<code>AndroidManifest.xml</code> file are now properties in the <code>defaultConfig</code> and +<code>productFlavors</code> blocks in the <code>build.gradle</code> file. The import process +copies these manifest settings to the properties in the <code>build.gradle</code> file. +These properties overwrite the settings in any other manifest files as shown in table 3. </p> + +<p class="table-caption" id="table-manifest-gradle-settings"> + <strong>Table 3.</strong> Manifest and Gradle property settings.</p> +<table> + <tr> + <th scope="col">Manifest Setting</th> + <th scope="col">build.gradle Setting</th> + </tr> + <tr> + <td><code><uses-sdk</code> <br> + <p><code>android:minSdkVersion</code></p> + <p><code>android:targetSdkVersion /></code></p> + </td> + <td> <br> + <p><code>minSdkVersion</code></p> + <p><code>targetSdkVersion</code></p> </td> + </tr> + <tr> + <td><code><manifest</code> + <p>package (Required in the default manifest file.) </p> + <p><code>android:versionCode</code></p> + <p><code>android:versionName /></code></p> + </td> + <td> <br> + <p><code>applicationId</code> (See + <a href="{@docRoot}tools/studio/index.html#app-id"> Application ID + for Package Identification</a>)</p> + <p><code>versionCode</code></p> + <p><code>versionName</code></p> </td> + </tr> + + </table> + + +<p>Although these settings may no longer appear in the default app manifest file, they are still +valid manifest entries and may still appear in manifests from older projects, imported projects, +dependencies, and libraries.</p> + +<p>The <code>package</code> element must still be specified in the manifest file. It is used in +your source code to refer to your <code>R</code> class and to resolve any relative activity/service +registrations. </p> + +<p class="note"><strong>Note:</strong> When multiple manifests are present in your app, for +example a library manifest and a <code>src/main/</code> manifest, the build process combines +the manifest settings into a single merged manifest based on the manifest priority and +manifest merge settings. For more information about the manifest merge process and merge settings, +see +<a href="{@docRoot}tools/building/manifest-merger.html"> Manifest Merger</a>. </p> + + +<h2>Application ID for package identification </h2> +<p>With the Android build system, the <code>applicationId</code> attribute is used to +uniquely identify application packages for publishing. The application ID is set in the +<code>android</code> section of the <code>build.gradle</code> file. This field is populated in the +build file as part of the migration process. </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 <code>applicationId</code> is specified only in your +<code>build.gradle</code> file, and not in the <code>AndroidManifest.xml</code> file.</p> + +<p><a href="{@docRoot}tools/building/configuring-gradle.html#workBuildVariants">Build variants</a> +enable you to uniquely identify different +packages for each product flavor and build type. The application ID in the build type setting can +be added as a suffix to the ID specified for the product flavors. The following example adds the +<code>.debug</code> suffix to the application ID of the <code>pro</code> and <code>free</code> +product flavors: </p> + +<pre> +productFlavors { + pro { + applicationId = "com.example.my.pkg.pro" + } + free { + applicationId = "com.example.my.pkg.free" + } +} + +buildTypes { + debug { + applicationIdSuffix ".debug" + } +} +.... +</pre> + + + +<h2 id="dependencies">Dependencies</h2> +<p>During the import process, Android Studio imports the current Eclipse ADT dependencies and +downloads any project libraries as Android Studio modules. The dependency declarations are added to +the <code>build.gradle</code> file. The declarations include a +<a href="#scopes">dependency scope</a>, such as +<code>compile</code>, to specify in which builds the dependency is included. </p> + +<p>The following example shows how to add an external library JAR dependency so it's included in +each compile:</p> + +<pre> +dependencies { + compile files('libs/*.jar') +} + +android { + ... +} +</pre> + +<p class="note"><strong>Note:</strong> Android Studio supports the Android ARchive (AAR) format +for the distribution of Android library projects as dependencies. For more information, see +<a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>. </p> + + +<p>The import process replaces any well-known source libraries, binary libraries, and JAR files +that have known Maven coordinates with Maven dependencies, so you no longer need to +maintain these dependencies manually. </p> + +<p>Android Studio enables access to Maven, JCenter, and Ivy repositories with the +<code>repositories</code> block in the <code>build.gradle</code> as a shortcut to specifying +the URL of the repository. + +<p>If there are required repositories not declared in the <code>build.gradle</code> file, first add +the repository to the <code>repositories</code> block, and then declare the dependencies in a way +that Maven, JCenter, or Ivy declare their artifacts. The following example shows how to add the +Maven repository with the guava 11.0.2 dependency using the <code>mavenCentral()</code> property: </p> + +<pre> +repositories { + mavenCentral() +} + +android { + ... +} + +dependencies { + compile 'com.google.guava:guava:11.0.2' + instrumentationtestCompile 'com.squareup.fast-android:1:0.4' +} + +</pre> + +<p>The Android Studio project created during the import process can also re-use any +dependencies on other components. These components can be external binary packages or other +<a href="http://www.gradle.org">Gradle</a> projects. If a dependency has dependencies of its own, +those dependencies are also included in the new Android Studio project. </p> + + +<p class="note"><strong>Note:</strong> If there were references to Eclipse ADT workspace library +files in the <code>project.properties</code> or <code>.classpath</code> files +that were not imported from the Eclipse project, you can now add dependencies to these library files +in the <code>build.gradle</code> file. For more information, see +<a href="{@docRoot}tools/building/configuring-gradle.html">Configuring Gradle Builds</a>. </p> + + +<h3 id="scopes">Dependency and compilation scopes </h3> +<p>Android Studio supports compilation scopes to customize which dependencies get +included in each build, for example assigning different dependencies to different +<a href="{@docRoot}tools/building/configuring-gradle.html#workBuildVariants"> build variants</a>.</p> + +<p>This list shows the Android Studio scope names and definitions: </p> + +<ul> + <li>compile - <code>compile</code> </li> + <li>run time - <code>package</code></li> + <li>testCompile - <code>AndroidTestCompile</code></li> + <li>testRuntime - <code>AndroidTestRunPackage</code></li> + <li>buildTypeCompile - <code>buildTypeCompile</code> </li> + <li>productFlavorCompile - <code>productFlavorCompile</code> </li> +</ul> + +<p class="note"><strong>Note:</strong> Dependencies for library projects must be added with the +<code>compile</code> scope. </p> + + +<p>With the <a href="http://www.gradle.org">Gradle</a>-based DSL, you can also add custom +dependency scopes, such as <code>betaCompile file('libs/protobug.jar')</code> to define a beta +build dependency. </p> + +<p>The scope and compilation configuration in the build file determine the +components compiled into the app, added to the compilation classpath, and packaged in the final +APK file. Based on the dependency and compilation scope, different compilation configurations +can be specified to include the dependencies and classpaths, for example: </p> + +<ul> +<li><code>compile</code> - for the main application. </li> +<li><code>androidTestCompile</code> - for the test application. </li> +<li><code>debugCompile</code> - for the debug buildType application.</li> +<li><code>releaseCompile</code> - for the release buildType application. </li> +</ul> + +<p class="note"><strong>Note:</strong> Because it’s not possible to build an APK that does not +have an associated <code>buildType</code>, the APK built from your app is always configured with +at least two dependency and compile configurations: <code>compile</code> and +<code>debugCompile</code>. </p> + +<p>Unlike Eclipse ADT, by default Android Studio does not compile your code when there are changes. +Use the <strong>File > Settings > Build, Execution, Deployment Compiler</strong> option +to enable automatic compilation. </p> + + + +<h2 id="build-process">Gradle-based Build Process </h2> +<p>Android Studio imports the Eclipse ADT Ant-based +build tasks and converts the tasks to <a href="http://www.gradle.org">Gradle</a>-based build tasks. +These new build tasks include the +main <code>assemble</code> task and at least two outputs based on the default build types: +a <code>debug</code> APK and a +<code>release</code> APK. Each of these build tasks has its own Android build system anchor task +to facilitate building them independently: </p> +<ul> + <li><code>assemble</code></li> + <li><code>assembleDebug</code></li> + <li><code>assembleRelease</code></li> +</ul> + +<p>In Android Studio, you can view all the supported build tasks in the +<em>Gradle</em> project tab. </p> + +<p>With the <a href="http://www.gradle.org">Gradle</a>-based build system, Android Studio uses a +<a href="http://www.gradle.org">Gradle</a> wrapper to fully integrate the +Android Plugin for Gradle. The Android Plugin for Gradle also +runs independent of Android Studio. This means that with Android Studio build system your build +output is always the same, whether you build your Android apps from Android Studio, from the +command line on your machine, or on machines where Android Studio is not installed (such as +continuous integration servers). </p> + +<p>Unlike Eclipse ADT with dependent plugin and build updates, the <code>build.gradle</code> +files allow you to customize the build settings for each Android Studio module and build variant, +so the build versions can be set independently, and are not dependent on the Android Studio +or build tools versions. This makes it easy to maintain and build legacy apps along with your +current app, using build variants to generate different APKs from the same app modules, but +built with different build versions and build chains. </p> + +<p>For more details about the Android Studio build system, see +<a href="{@docRoot}sdk/installing/studio-build.html">Build System Overview</a>.</p> + +<h3>Using the Android Studio build system's declarative logic </h3> +<p>In contrast with the XML statements in Ant build files, the Android build system and +<a href="http://www.gradle.org">Gradle</a> DSL provide a declarative build language so you can +easily extend the Gradle-based build process beyond the typical XML build tasks. For example, +this build file shows how to define a custom function to inject a dynamic <code>versionCode</code> +in build outputs: </p> + +<pre> +def getVersionCode) { + def code = … + return code +} + +android { + defaultConfig { + versionCode getVersionCode() + … + } +} +</pre> + +<p>This example shows how to append <em>debug</em> to your package and version names used in the +<code>debug</code> build variant of your app: </p> + +<pre> +android { + buildTypes { + debug { + packageNameSuffix ‘.debug’ + versionNameSuffix ‘-DEBUG’ + } + beta { + … + } + } +} +</pre> + + +<p>You can also use the declarative DSL in the Android build system to generate custom build +versions, for example a debuggable version of your release APK. This examples adds the +<code>debuggable true</code> property to the <code>release</code> build type in the +<code>build.gradle</code> file to build an identical debuggable version of the release package. </p> + +<pre> +android { + buildTypes { + debugRelease.initWith(buildTypes.release) + debugRelease { + debuggable true + packageNameSuffix '.debugrelease' + signingConfig signingConfigs.debug + } + + } + sourceSets.debugRelease.setRoot('src/release') +} +</pre> + + + + + + +<h2 id="debug-inspect">Debugging and Code Inspections</h2> +<p>Using code inspection tools such as <a href="{@docRoot}tools/help/lint.html">lint</a> is a +standard part of Android development. Android Studio extends +<a href="{@docRoot}tools/help/lint.html">lint</a> support with additional +<a href="{@docRoot}tools/help/lint.html">lint</a> checks and supports Android +<a href="{@docRoot}tools/debugging/annotations.html">annotations</a> that +allow you to help detect more subtle code problems, such as null pointer exceptions and resource +type conflicts. Annotations are added as metadata tags that you attach to variables, parameters, +and return values to inspect method return values, passed parameters, and local variables and +fields. </p> + +<p>For more information on enabling <a href="{@docRoot}tools/help/lint.html">lint</a> inspections +and running <a href="{@docRoot}tools/help/lint.html">lint</a>, +see <a href="{@docRoot}tools/debugging/improving-w-lint.html">Improving Your Code with lint</a>. +For more information about using annotations, see +<a href="{@docRoot}tools/debugging/annotations.html#annotations">Improving your Code with +Annotations</a>. </p> + +<p>In addition to code inspection, Android Studio provides an integrated +<a href="{@docRoot}tools/studio/index.html#mem-cpu">memory and CPU monitor</a> 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. </p> + + + +<h2 id="resource-optimization">Resource Optimization </h2> +<p>After importing and building your app, Android Studio supports several +<a href="http://www.gradle.org">Gradle</a>-based properties to help you minimize your app's +resource utilization. </p> + + +<h3>Resource shrinking</h3> +<p>In Android Studio, resource shrinking enables the automatic removal of unused resources from +your packaged app and also removes resources from library dependencies if the resources are not +actually used by your app.</p> + +<p>Use the <code>shrinkResources</code> attribute in the <code>buildType</code> block in your +<code>build.gradle</code> file to enable resource shrinking. For example, if your application is +using <a href="{@docRoot}google/play-services/index.html">Google Play services</a> +to access Google Drive functionality, and you are not currently using +<a href="{@docRoot}google/play-services/plus.html">Google+ Sign In</a>, then +this setting removes the various drawable assets for the <code>SignInButton</code> buttons. </p> + +<p class="note"><strong>Note:</strong> Resource shrinking works in conjunction with code shrinking +tools, such as <a href="{@docRoot}tools/help/proguard.html">ProGuard</a>. </p> + +<p>To enable resource shrinking, update the <code>buildTypes</code> block in the +<code>build.gradle</code> file to include <code>minifyEnabled true</code>, +<code>shrinkResources true</code>, and <code>proguardFiles</code> settings as shown in the +following example <a href="http://www.gradle.org">Gradle</a> build file.</p> + +<pre> +android { + ... + + buildTypes { + release { + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile('proguard-android.txt'), + 'proguard-rules.pro' + } + } +} +</pre> + + + +<h3>Filtering language resources</h3> +<p>Use the <code>resConfig</code> attribute in your <code>build.gradle</code> file +to filter the locale resources included in your packaged app. This filtering can be especially +useful when library dependencies such as <code>appcompat-v7</code> and other libraries such as +<code>google-play-services_lib</code> are included in your app. </p> + +<p>The following example limits the locale resources to three language settings: <code>en</code>, +<code>de</code>, and <code>es</code>:</p> + +<pre> +apply plugin: 'android' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + minSdkVersion 8 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + resConfigs "en", "de", "es" //Define the included language resources. + } +... + +</pre> + + + +<h4>Filtering bundled resources</h4> +<p>You can also use the <code>resConfig</code> build setting to limit the bundled resources +in any resource folder. For example, you could also add <code>resConfigs</code> +settings for density folders, such as <code>mdpi</code> or <code>hdpi</code> to limit the drawable +resources that are packaged in your <code>APK</code> file. This example limits the app's +bundled resources to medium-density (MDPI) and high-density (HDPI) resources. </p> + +<pre> +android { + defaultConfig { + ... + resConfigs "mdpi", "hdpi" + } +} +</pre> + +For more information about screen and resource densities, see +<a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a> +and <a href="{@docRoot}training/multiscreen/screendensities.html">Supporting Different Densities</a>. + + +<h3>Resource merging </h3> +<p>With Android Studio, identical resources, such as copies of launcher and menu icons, may end up +in different resource folders throughout your app. To reduce resource duplication and improve +the performance of your app, Android Studio merges resources with an identical resource name, type, +and qualifier into a single resource and passes the single, merged resource to the Android Asset +Packaging Tool (AAPT) for distribution in the APK file. </p> + +<p>The resource merging process looks for identical resources in the following <code>/res/</code> +folders: </p> +<ul> + <li>AAR bundles of library project dependencies</li> + <li><code>src/main/</code> </li> + <li><code>src/<em>productFlavor</em>/</code> </li> + <li><code>src/<em>buildType</em>/</code> </li> +</ul> + +<p>Identical resources are merged in the following low to high priority order: </p> +<pre> +dependencies --> src/main/ --> src/productFlavor/ --> src/buildType/ +</pre> + +<p>For example, if the <code>res/ic_menu.png</code> file is included in both the +<code>src/main/res/</code> and <code>src/productFlavor/res/</code> folders, the resources are merged +so only the file with the higher priority, in this case the <code>src/productFlavor/res/</code> +file, is included in the APK file. </p> + +<p class="note"><strong>Note:</strong> Identical resources in the same source set are not merged +and instead generate a resource merge error. This can happen if the <code>sourceSet</code> property +in the <code>build.gradle</code> file is used to define multiple source sets, for example +<code>src/main/res/</code> and <code>src/main/res2/</code>, and these folders contain identical +resources. </p> + + + + +<h2 id="signing">App Signing and ProGuard </h2> +<p>Based on the imported Eclipse ADT app settings, Android Studio automatically sets up your app +signing and maintains any ProGuard settings. </p> + +<h3>App Signing</h3> +<p>If your app used a debug certificate in Eclipse ADT, Android Studio continues to reference that +certificate. Otherwise, the <code>debug</code> configuration uses the Android Studio generated +debug keystore, with a known password and a default key with a known password located in +<code>$HOME/.android/debug.keystore</code>. The <code>debug</code> build type is set to use this +debug <code>SigningConfig</code> automatically when you run or debug your project +from Android Studio. </p> + +<p>In release mode, Android Studio applies the release certificate used in Eclipse ADT. If no +release certificate was located during the import process, add the release signing configuration to +the <code>build.gradle</code> file or use the <strong> Build > Generate Signed APK</strong> menu +option to open the Generate Signed APK Wizard. For more information about signing your app, see +<a href="{@docRoot}tools/publishing/app-signing.html">Signing Your Applications</a>. </p> + + +<h3>ProGuard</h3> +<p>If the <a href="{@docRoot}tools/help/proguard.html">ProGuard</a> option is specified in the +<code>project.properties</code> file in the Eclipse ADT project, Android Studio imports the +<a href="{@docRoot}tools/help/proguard.html">ProGuard</a> files and adds the +<a href="{@docRoot}tools/help/proguard.html">ProGuard</a> settings to the +<code>build.gradle</code> file. <a href="{@docRoot}tools/help/proguard.html">ProGuard</a> is +supported through the <code>minifyEnabled</code> property as shown in this example. </p> + +<pre> +android { + buildTypes { + release { + minifyEnabled true + proguardFile getDefaultProguardFile('proguard-android.txt') + } + } + + productFlavors { + flavor1 { + } + flavor2 { + proguardFile 'some-other-rules.txt' + } + } +} + +</pre></p> + + + + +<h2 id="support-lib">Android Support Repository and Google Play services Repository</h2> +<p>While Eclipse ADT uses the Android <a href="{@docRoot}tools/support-library/index.html">Support +Library</a> and Google Play services Library, Android Studio replaces these libraries during the +import process with the Android Support Repository and Google Repository to maintain +compatible functionality and support new Android features. Android Studio adds these dependencies +as Maven dependencies using the known Maven coordinates, so these dependencies do not require +manual updates. </p> + +<p>In Eclipse, in order to use a +<a href="{@docRoot}tools/support-library/index.html">Support Library</a>, you must modify your +project's classpath dependencies within your development environment for each +<a href="{@docRoot}tools/support-library/index.html">Support Library</a> you want to use. In +Android Studio, you no longer need to copy library sources into your +own projects, you can simply declare a dependency and the library is automatically downloaded and +merged into your project. This includes automatically merging in resources, manifest entries, +<a href="{@docRoot}tools/help/proguard.html">ProGuard</a> exclusion rules, and custom lint rules +at build time. </p> + +<p>Android Studio also supports binary library Android ARchives (AARs). AARs are a library project's +main output as a combination of compiled code (as a jar file and/or native .so files) and +resources (manifest, res, assets). <p/> + + +<h2 id="app-package">App Packaging</h2> +<p>The Android build system introduces the use of the <code>applicationId</code> attribute to +uniquely identify application packages for publishing. The application ID is set in the +<code>android</code> section of the <code>build.gradle</code> file. </p> + +<p>The <code>applicationId</code> is specified only in your <code>build.gradle</code> file, and +not in the +<code>AndroidManifest.xml</code> file. The Gradle-based build system enables you +to uniquely identify different packages for each build variant based on product flavors and build +types. You can also add the <code>applicationIdSuffix</code> property to the build type in the +<code>build.gradle</code> file to append an identifier, such as '.debug', to the application ID +generated for each product flavor. </p> + + + +<h2 id="software-updates">Software Updates</h2> +<p>Android Studio provides several levels of update and maintenance to help you keep Android Studio +up-to-date based on your code-level preference: </p> + +<ul> + <li><strong>Canary channel</strong>: Canary builds provide bleeding edge releases and are updated + about weekly. These builds do get tested, but are still subject to bugs, as these are + early releases. This is not recommended for production.</li> + <li><strong>Dev channel</strong>: Dev builds are canary builds that passed initial testing and + usage. They are updated roughly bi-weekly or monthly.</li> + <li><strong>Beta channel</strong>: Beta builds provide beta-quality releases for final testing + and feedback before a production release.</li> + <li><strong>Stable channel</strong>: Stable builds provide stable, production-ready release + versions.</li> +</ul> + + + +<h2 id="version-control">Version Control </h2> +<p>Eclipse ADT supports version control through the use of plugins, such as the EGit and Subversive +plug-ins. </p> + +<p>Android Studio supports a variety of version control systems (Git, GitHub, CVS, Mercurial, +Subversion, and Google Cloud) so version control operations can continue from within Android +Studio. </p> + +<p>After importing your Eclipse ADT app into Android Studio, use the +Android Studio <em>VCS</em> menu options to enable VCS support for the desired version control +system, create a repository, import the new files into version control, and perform other version +control operations. </p> + +<p class="note"><strong>Note:</strong> You can also use the +<strong>File > Setting > Version Control</strong> menu option to setup and modify the version +control settings. </p> + +<h3>Files to ignore </h3> +<p>A number of Android Studio files are typically not added to version control as these are +temporary files or files that get overwritten with each build. These files are listed in +an exclusion file, such as <code>.gitignore</code>, for the project and each app module. +Typically, the following files are excluded from version control: </p> + +<ul> + <li>.gradle </li> + <li>/local.properties </li> + <li>/.idea/workspace.xml </li> + <li>/.idea/libraries </li> + <li>.DS_Store</li> + <li>/build </li> + <li>/captures </li> +</ul> diff --git a/docs/html/tools/studio/index.jd b/docs/html/tools/studio/index.jd index 0346404..5041b83 100644 --- a/docs/html/tools/studio/index.jd +++ b/docs/html/tools/studio/index.jd @@ -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 @@ -141,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 @@ -176,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>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 @@ -350,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> @@ -506,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 @@ -520,232 +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> - diff --git a/docs/html/tools/studio/studio-config.jd b/docs/html/tools/studio/studio-config.jd new file mode 100644 index 0000000..f9646b8 --- /dev/null +++ b/docs/html/tools/studio/studio-config.jd @@ -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> + + + diff --git a/docs/html/tools/studio/studio-features.jd b/docs/html/tools/studio/studio-features.jd new file mode 100644 index 0000000..76eba10 --- /dev/null +++ b/docs/html/tools/studio/studio-features.jd @@ -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> + + + diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs index a5e617d..db19d4f 100644 --- a/docs/html/tools/tools_toc.cs +++ b/docs/html/tools/tools_toc.cs @@ -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> @@ -151,12 +155,7 @@ <div class="nav-section-header"><a href="<?cs var:toroot ?>tools/help/index.html"><span class="en">Tools Help</span></a></div> <ul> - <li class="nav-section"> - <div class="nav-section-header"><a href="<?cs var:toroot ?>tools/help/adb.html">adb</a></div> - <ul> - <li><a href="<?cs var:toroot ?>tools/help/shell.html">Shell commands</a></li> - </ul> - </li> + <li><a href="<?cs var:toroot ?>tools/help/adb.html">adb</a></li> <li><a href="<?cs var:toroot ?>tools/help/android.html">android</a></li> <li><a href="<?cs var:toroot ?>tools/help/avd-manager.html">AVD Manager</a></li> <li><a href="<?cs var:toroot ?>tools/help/bmgr.html">bmgr</a> @@ -173,7 +172,6 @@ class="en">Tools Help</span></a></div> <li><a href="<?cs var:toroot ?>tools/help/mksdcard.html">mksdcard</a></li> <li><a href="<?cs var:toroot ?>tools/help/proguard.html" zh-cn-lang="ProGuard">ProGuard</a></li> <li><a href="<?cs var:toroot ?>tools/help/sdk-manager.html">SDK Manager</a></li> - <li><a href="<?cs var:toroot ?>tools/help/sqlite3.html">sqlite3</a></li> <li><a href="<?cs var:toroot ?>tools/help/systrace.html">Systrace</a></li> <li><a href="<?cs var:toroot ?>tools/help/gltracer.html">Tracer for OpenGL ES</a></li> <li><a href="<?cs var:toroot ?>tools/help/traceview.html">Traceview</a></li> @@ -195,11 +193,14 @@ class="en">Tools Help</span></a></div> <span class="en">Configuring Gradle Builds</span></a></li> <li><a href="<?cs var:toroot ?>tools/building/plugin-for-gradle.html"> <span class="en">Android Plugin for Gradle</span></a></li> + <li><a href="<?cs var:toroot ?>tools/building/manifest-merge.html"> + <span class="en">Manifest Merging</span></a></li> <li><a href="<?cs var:toroot ?>tools/building/multidex.html"> <span class="en">Apps Over 65K Methods</span></a></li> </ul> </li><!-- end of build system --> + <!-- Performance Tools menu--> <li class="nav-section"> <div class="nav-section-header"> @@ -260,6 +261,7 @@ class="en">Tools Help</span></a></div> </ul> </li><!-- End Performance Tools menu--> + <!-- Testing Tools menu--> <li class="nav-section"> @@ -357,7 +359,15 @@ class="en">Data Binding Library</span></a></div> <span class="en">Eclipse with ADT</span></a> </div> <ul> - <li><a href="<?cs var:toroot ?>sdk/installing/migrate.html">Migrating to Android Studio</a></li> + <li class="nav-section"> + <div class="nav-section-header"><a href="<?cs var:toroot ?>sdk/installing/migrate.html"> + <span class="en">Migrating to Android Studio</span></a></div> + <ul> + <li><a href="<?cs var:toroot ?>tools/studio/eclipse-transition-guide.html"> + Transition Guide</span></a> </li> + </ul> + </li> + <li><a href="<?cs var:toroot ?>sdk/installing/installing-adt.html"> <span class="en">Installing the Eclipse Plugin</span></a></li> <li><a href="<?cs var:toroot ?>tools/projects/projects-eclipse.html">Managing Projects</a></li> diff --git a/docs/html/tools/workflow/index.jd b/docs/html/tools/workflow/index.jd index a24a2b0..b32fa26 100644 --- a/docs/html/tools/workflow/index.jd +++ b/docs/html/tools/workflow/index.jd @@ -41,16 +41,16 @@ figure 1. The development steps encompass four development phases, which include <a href="{@docRoot}tools/projects/index.html">Create an Android project</a>.</p> </li> <li><strong>Building, Debugging and Testing</strong> - <p>During this phase you build your project into a debuggable <code>.apk</code> package(s) - that you can install and run on the emulator or an Android-powered device. Android Studio uses - a build system based on <a href="http://www.gradle.org/" target="_android">Gradle</a> - that provides flexibility, customized build variants, dependency resolution, and much more. - If you're using another IDE, you can build your project using Gradle and install it on a device + <p>During this phase you build your project into a debuggable <code>.apk</code> package(s) + that you can install and run on the emulator or an Android-powered device. Android Studio uses + a build system based on <a href="http://www.gradle.org/" target="_android">Gradle</a> + that provides flexibility, customized build variants, dependency resolution, and much more. + If you're using another IDE, you can build your project using Gradle and install it on a device using <a href="{@docRoot}tools/help/adb.html">adb</a>. For more information, see <a href="{@docRoot}tools/building/index.html">Build and run your application</a>.</p> <p>Next, with Android Studio you debug your application using the - <a href="{@docRoot}tools/help/monitor.html">Android Debug Monitor</a> and device log messages - (<a href="{@docRoot}tools/help/logcat.html">logact</a>) along with the IntelliJ IDEA intelligent + <a href="{@docRoot}tools/help/monitor.html">Android Device Monitor</a> and device log messages + (<a href="{@docRoot}tools/help/logcat.html">logcat</a>) along with the IntelliJ IDEA intelligent coding features. You can also use a JDWP-compliant debugger along with the debugging and logging tools that are provided with the Android SDK. For more information see <a href="{@docRoot}tools/debugging/index.html">Debug your application with the SDK debugging and logging tools</a>.</p> diff --git a/docs/html/training/safetynet/index.jd b/docs/html/training/safetynet/index.jd index 6090f41..6d822c6 100644 --- a/docs/html/training/safetynet/index.jd +++ b/docs/html/training/safetynet/index.jd @@ -325,7 +325,7 @@ certificate used to sign requesting app"], <li>Obtain your API key by expanding <strong>APIs & auth</strong> and clicking <strong>Credentials</strong>. - Record the <strong>API KEY</strong> value on this page for later use. + Record the <strong>API KEY</strong> (<em>not</em> the <em>Android Key</em>) value on this page for later use. </li> </ol> diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs index e1e6838..5279969 100644 --- a/docs/html/training/training_toc.cs +++ b/docs/html/training/training_toc.cs @@ -91,25 +91,60 @@ include the action bar on devices running Android 2.1 or higher." <li class="nav-section"> <div class="nav-section-header"> <a href="<?cs var:toroot ?>training/basics/activity-lifecycle/index.html" + es-lang="" + ja-lang="アクティビティのライフサイクル 管理" + ko-lang="액티비티 수명 주기 관리하기" + pt-br-lang="Como gerenciar o ciclo de vida da atividade" + ru-lang="Управление жизненным циклом операций" + zh-cn-lang="管理活动生命周期" + zh-tw-lang="管理應用行為顯示生命週期" description= "How Android activities live and die and how to create a seamless user experience by implementing lifecycle callback methods." >Managing the Activity Lifecycle</a> </div> <ul> - <li><a href="<?cs var:toroot ?>training/basics/activity-lifecycle/starting.html"> + <li><a href="<?cs var:toroot ?>training/basics/activity-lifecycle/starting.html" + es-lang="" + ja-lang="アクティビティを開始する" + ko-lang="액티비티 시작하기" + pt-br-lang="Iniciando uma atividade" + ru-lang="Запуск операции" + zh-cn-lang="开始活动" + zh-tw-lang="啟動應用行為顯示"> Starting an Activity </a> </li> - <li><a href="<?cs var:toroot ?>training/basics/activity-lifecycle/pausing.html"> + <li><a href="<?cs var:toroot ?>training/basics/activity-lifecycle/pausing.html" + es-lang="" + ja-lang="" + ko-lang="" + pt-br-lang="" + ru-lang="" + zh-cn-lang="" + zh-tw-lang=""> Pausing and Resuming an Activity </a> </li> - <li><a href="<?cs var:toroot ?>training/basics/activity-lifecycle/stopping.html"> + <li><a href="<?cs var:toroot ?>training/basics/activity-lifecycle/stopping.html" + es-lang="" + ja-lang="アクティビティの一時停止と再開" + ko-lang="액티비티 일시정지 및 재개하기" + pt-br-lang="Pausando e reiniciando uma atividade" + ru-lang="Приостановка и возобновление операции" + zh-cn-lang="暂停和继续活动" + zh-tw-lang="暫停並繼續應用行為顯示"> Stopping and Restarting an Activity </a> </li> - <li><a href="<?cs var:toroot ?>training/basics/activity-lifecycle/recreating.html"> + <li><a href="<?cs var:toroot ?>training/basics/activity-lifecycle/recreating.html" + es-lang="" + ja-lang="アクティビティを再作成する" + ko-lang="액티비티 재생성하기" + pt-br-lang="Recriando uma atividade" + ru-lang="Воссоздание операции" + zh-cn-lang="重新创建活动" + zh-tw-lang="重新建立應用行為顯示"> Recreating an Activity </a> </li> @@ -144,21 +179,49 @@ include the action bar on devices running Android 2.1 or higher." <li class="nav-section"> <div class="nav-section-header"><a href="<?cs var:toroot?>training/basics/data-storage/index.html" + es-lang="" + ja-lang="データの保存" + ko-lang="데이터 저장하기" + pt-br-lang="Salvando dados" + ru-lang="Сохранение данных" + zh-cn-lang="保存数据" + zh-tw-lang="儲存資料" description= "How to save data on the device, whether it's temporary files, downloaded app assets, user media, structured data, or something else." >Saving Data</a> </div> <ul> - <li><a href="<?cs var:toroot ?>training/basics/data-storage/shared-preferences.html"> + <li><a href="<?cs var:toroot ?>training/basics/data-storage/shared-preferences.html" + es-lang="" + ja-lang="キー値セットを保存する" + ko-lang="키-값 세트 저장하기" + pt-br-lang="Salvando conjuntos de valor-chave" + ru-lang="Сохранение наборов "\"ключ-значение\"" + zh-cn-lang="保存键值集" + zh-tw-lang="儲存索引鍵值組"> Saving Key-Value Sets </a> </li> - <li><a href="<?cs var:toroot ?>training/basics/data-storage/files.html"> + <li><a href="<?cs var:toroot ?>training/basics/data-storage/files.html" + es-lang="" + ja-lang="ファイルを保存する" + ko-lang="파일 저장하기" + pt-br-lang="Salvando arquivos" + ru-lang="Сохранение файлов" + zh-cn-lang="保存文件" + zh-tw-lang="儲存檔案"> Saving Files </a> </li> - <li><a href="<?cs var:toroot ?>training/basics/data-storage/databases.html"> + <li><a href="<?cs var:toroot ?>training/basics/data-storage/databases.html" + es-lang="" + ja-lang="SQL データベースにデータを保存する" + ko-lang="SQL 데이터베이스에 데이터 저장하기" + pt-br-lang="Salvando dados em bancos de dados do SQL" + ru-lang="Сохранение данных в базах данных SQL" + zh-cn-lang="在 SQL 数据库中保存数据" + zh-tw-lang="在 SQL 資料庫中儲存資料"> Saving Data in SQL Databases </a> </li> @@ -168,6 +231,13 @@ include the action bar on devices running Android 2.1 or higher." <li class="nav-section"> <div class="nav-section-header"> <a href="<?cs var:toroot ?>training/basics/intents/index.html" + es-lang="" + ja-lang="他のアプリとの相互操作" + ko-lang="액티비티 수명 주기 관리하기" + pt-br-lang="Interagindo com outros aplicativos" + ru-lang="Взаимодействие с другими приложениями" + zh-cn-lang="与其他应用交互" + zh-tw-lang="與其他應用程式互動" description= "How to build a user experience that leverages other apps available on the device to perform advanced user tasks, such as capture a photo or view @@ -175,15 +245,36 @@ include the action bar on devices running Android 2.1 or higher." >Interacting with Other Apps</a> </div> <ul> - <li><a href="<?cs var:toroot ?>training/basics/intents/sending.html"> + <li><a href="<?cs var:toroot ?>training/basics/intents/sending.html" + es-lang="" + ja-lang="別のアプリにユーザーを送る" + ko-lang="다른 앱으로 사용자 보내기" + pt-br-lang="Enviando o usuário para outro aplicativo" + ru-lang="Направление пользователя в другое приложение" + zh-cn-lang="向另一个应用发送用户" + zh-tw-lang="將使用者傳送至其他應用程式"> Sending the User to Another App </a> </li> - <li><a href="<?cs var:toroot ?>training/basics/intents/result.html"> + <li><a href="<?cs var:toroot ?>training/basics/intents/result.html" + es-lang="" + ja-lang="アクティビティから結果を取得する" + ko-lang="액티비티로부터 결과 가져오기" + pt-br-lang="Obtendo resultados de uma atividade" + ru-lang="Получение результата операции" + zh-cn-lang="获取活动的结果" + zh-tw-lang="從應用行為顯示取得結果"> Getting a Result from the Activity </a> </li> - <li><a href="<?cs var:toroot ?>training/basics/intents/filters.html"> + <li><a href="<?cs var:toroot ?>training/basics/intents/filters.html" + es-lang="" + ja-lang="他のアプリからのアクティビティの開始を許可する" + ko-lang="다른 앱이 자신의 액티비티를 시작하도록 허용하기" + pt-br-lang="Permitindo que outros aplicativos iniciem sua atividade" + ru-lang="Разрешение другим приложениям на запуск вашей операции" + zh-cn-lang="允许其他应用开始您的活动" + zh-tw-lang="允許其他應用程式啟動您的應用行為顯示"> Allowing Other Apps to Start Your Activity </a> </li> diff --git a/docs/html/training/volley/requestqueue.jd b/docs/html/training/volley/requestqueue.jd index 6858d91..63c743a 100644 --- a/docs/html/training/volley/requestqueue.jd +++ b/docs/html/training/volley/requestqueue.jd @@ -139,7 +139,8 @@ rotates the device). <p>Here is an example of a singleton class that provides {@code RequestQueue} and {@code ImageLoader} functionality:</p> -<pre>private static MySingleton mInstance; +<pre>public class MySingleton { + private static MySingleton mInstance; private RequestQueue mRequestQueue; private ImageLoader mImageLoader; private static Context mCtx; diff --git a/docs/html/training/wearables/watch-faces/drawing.jd b/docs/html/training/wearables/watch-faces/drawing.jd index 8b6de76..30a7a6f 100644 --- a/docs/html/training/wearables/watch-faces/drawing.jd +++ b/docs/html/training/wearables/watch-faces/drawing.jd @@ -457,9 +457,23 @@ watch face. The bounds take into account any inset areas, such as the "chin" on round devices. You can use this canvas to draw your watch face directly as follows:</p> <ol> -<li>If this is the first invocation of the -<a href="{@docRoot}reference/android/support/wearable/watchface/CanvasWatchFaceService.Engine.html#onDraw(android.graphics.Canvas, android.graphics.Rect)"><code>onDraw()</code></a> -method, scale your background to fit.</li> +<li>Override the +<a href="{@docRoot}reference/android/support/wearable/watchface/CanvasWatchFaceService.Engine.html#onSurfaceChanged(android.view.SurfaceHolder, int, int, int)"><code>onSurfaceChanged()</code></a> +method to scale your background to fit the device any time the view changes. +<pre> +@Override +public void onSurfaceChanged( + SurfaceHolder holder, int format, int width, int height) { + if (mBackgroundScaledBitmap == null + || mBackgroundScaledBitmap.getWidth() != width + || mBackgroundScaledBitmap.getHeight() != height) { + mBackgroundScaledBitmap = Bitmap.createScaledBitmap(mBackgroundBitmap, + width, height, true /* filter */); + } + super.onSurfaceChanged(holder, format, width, height); +} +</pre> +</li> <li>Check whether the device is in ambient mode or interactive mode.</li> <li>Perform any required graphic computations.</li> <li>Draw your background bitmap on the canvas.</li> @@ -482,13 +496,6 @@ public void onDraw(Canvas canvas, Rect bounds) { int width = bounds.width(); int height = bounds.height(); - // Draw the background, scaled to fit. - if (mBackgroundScaledBitmap == null - || mBackgroundScaledBitmap.getWidth() != width - || mBackgroundScaledBitmap.getHeight() != height) { - mBackgroundScaledBitmap = Bitmap.createScaledBitmap(mBackgroundBitmap, - width, height, true); - } canvas.drawBitmap(mBackgroundScaledBitmap, 0, 0, null); // Find the center. Ignore the window insets so that, on round watches |
