diff --git a/docs/html/images/tools/as-debugbutton.png b/docs/html/images/tools/as-debugbutton.png index 55e95d1b6668d..f8edf4d550581 100644 Binary files a/docs/html/images/tools/as-debugbutton.png and b/docs/html/images/tools/as-debugbutton.png differ diff --git a/docs/html/images/tools/as-find-apk.png b/docs/html/images/tools/as-find-apk.png new file mode 100644 index 0000000000000..e68d2b15b0cb5 Binary files /dev/null and b/docs/html/images/tools/as-find-apk.png differ diff --git a/docs/html/images/tools/as-gradle.png b/docs/html/images/tools/as-gradle.png new file mode 100644 index 0000000000000..a1b88ae8711fe Binary files /dev/null and b/docs/html/images/tools/as-gradle.png differ diff --git a/docs/html/images/tools/as-run.png b/docs/html/images/tools/as-run.png index 76c7020db4341..dbc3e33bec988 100644 Binary files a/docs/html/images/tools/as-run.png and b/docs/html/images/tools/as-run.png differ diff --git a/docs/html/images/tools/signstudio3.png b/docs/html/images/tools/signstudio3.png index f25bf002cfad9..4d51764d94dbf 100644 Binary files a/docs/html/images/tools/signstudio3.png and b/docs/html/images/tools/signstudio3.png differ diff --git a/docs/html/tools/building/building-studio.jd b/docs/html/tools/building/building-studio.jd index ef6e94bcfb23f..2e3615e44a0df 100644 --- a/docs/html/tools/building/building-studio.jd +++ b/docs/html/tools/building/building-studio.jd @@ -6,239 +6,182 @@ parent.link=index.html
+ By default, Android Studio sets up new projects to deploy to the Emulator or + a physical device with just a few clicks. +
-This document shows you how to use Android Studio to build an application .apk for
-testing or release and how to run your application on an emulator or a real device.
+ To build and run your app, click Run 'app' . Android Studio builds your app with
+ Gradle, asks you to select a deployment target (an emulator or a connected
+ device), and then deploys your app to it. You can customize some of this
+ default behavior, such as selecting an automatic deployment target, by
+ changing the run configuration.
+
+ If you want to use the Android + Emulator to run your app, you need to have an Android Virtual Device + (AVD) ready. If you haven't already created one, then after you click + Run 'app', click Create New Emulator in the + Select Deployment Target dialog. Follow the Virtual Device + Configuration wizard to define the type of device you want to emulate. For + more information, see Managing AVDs with the AVD + Manager. +
-+ If you're using a physical Android device, you need to enable USB debugging + on the device. For more information, see Using Hardware Devices. +
-To build the project on Android Studio, click Build and select -Make Project. The status bar at the bottom of the window shows the current -progress of the build:
+
+ Note: You can also deploy your app in debug mode by clicking
+ Debug 'app' . Running your app in debug mode
+ allows you to set breakpoints in your code, examine variables and evaluate
+ expressions at run time, and run debugging tools. To learn more, read about
+ Debugging with
+ Android Studio.
+
Gradle: Executing tasks: [:app:assembleDebug, :lib:bundleDebug]
Click
on the bottom
-right part of the window to show the Gradle Console, as shown in figure 1.
+ The run configuration specifies the module to run, package to deploy, + activity to start, target device, emulator settings, and Logcat options. The + default run configuration launches the default project activity and uses the + Device Chooser for target device selection. If the default + settings don't suit your project or module, you can customize the run + configuration, or even create a new one, at the project, default, and module + levels. To edit a run configuration: +
-
-Figure 1. The Gradle Console in Android Studio.
+The Gradle Console shows the build tasks and subtasks that the build system runs for
-Android Studio. If the build fails, you can find more details on the console. To hide the Gradle
-Console, click
again.
If your project uses product flavors, Android Studio invokes the task for the -selected build variant. For more information, see the -Build System guide.
- -To view the list of all available build tasks in Android Studio, click Gradle -on the right side of the IDE window. The Gradle tasks panel appears.
- - -You can now use the Build menu options to build the release version of your -application for distribution.
- -The build generates an APK for each build variant:
-the app/build/apk/ directory contains packages named
-app-<flavor>-<buildtype>.apk; for example, app-full-release.apk and
-app-demo-debug.apk.
For more build system information, see -Build System.
- - -This section shows you how to run your application on an emulator or a real device - from Android Studio—all of which is done using the debug version of your application. - For more information about how to sign your application with a private key for release, see - Signing Your Applications
- - -The run configuration specifies the module to run, package to deploy, Activity to start, - target device, emulator settings, and Logcat options. Run configuration can be set at the project, - default, and module levels. When you first run a module as an Android Application, - Android Studio will automatically create a run configuration. The default run - configuration will launch the default project Activity and use automatic target mode for device - selection (with no preferred AVD). If the default settings don't suit your project or module, you - can customize the run configuration or even create a new one.
- -To create or modify a run configuration, see the IntelliJ documentation on - - Run/Debug configurations.
- -The following steps highlight the important things you need to do for an Android project:
- --scale 96dpi to scale the AVD's screen
- to an accurate size, based on the dpi of your computer monitor. For a full list of emulator
- options, see the Android
- Emulator document.
- By default, a run configuration uses the automatic target mode in order to - select an AVD. In this mode, Android Studio will select an AVD for the application in the following - manner:
++ By default, Android Studio builds the debug version of your app, which is + intended only for testing, when you click Run 'app'. You + need to build the release version when preparing your app for public + release. +
++ To change the build variant Android Studio uses, go to Build + > Select Build Variant and select a different one from + the drop-down menu. By default, new projects are set up with a debug and + release build variant. +
-+ Using product flavors, you can create additional build variants for + different versions of your app, each having different features or device + requirements. To learn more about build variants and product flavors, read + Configuring Gradle + Builds. +
-
+ You can view details about the build process by clicking Gradle
+ Console
. The console displays each
+ task that Gradle executes in order to build your app, as shown in figure 1.
+
++ Figure 1. The Gradle Console in Android Studio. +
-However, if a "preferred" AVD is selected in the run configuration, then the application will - always be deployed to that AVD. If it's not already running, then a new emulator will be - launched.
+
+ If your build variants use product flavors, Gradle also invokes tasks to
+ build those product flavors. To view the list of all available build tasks,
+ click Gradle on the right side of the IDE
+ window.
+
If your run configuration uses manual mode, then the "device chooser" is - presented every time that your application is run, so that you can select which AVD to use.
++ If an error occurs during the build process, the Messages window + will appear to describe the issue. +
++ When you click Run 'app', Android Studio generates a debug + APK and deploys it to your target device. Before you can generate a release + version of your app for public distribution, however, you must first learn + how to sign your + app. You can then generate multiple signed APKs of your debug or release + build variants. To locate the generated APK files, click the link in the + pop-up dialog, as shown in figure 2. +
-Before you can run your application on the Android Emulator, you verify the default AVD or - create an AVD.
- -To run (or debug) your application, select Run > Run (or - Run > debug) from the Android Studio menu bar. Android Studio - automatically creates a default run configuration for the project. Android Studio will then perform - the following:
- -By default, Android run configurations use an "automatic target" mode for selecting a - device target. For information on how automatic target mode selects a deployment target, see - Automatic and manual target modes above.
-If you run the application with Debug, the Choose a Device option - appears so you can select an attached device or emulator. Once the device or emulator is selected, - Android Studio opens the Debug console and starts the application's main activity. Otherwise, if - you run the application with the normal Run command, Android Studio installs the application on the - device and launches the main activity.
- -To set or change the run configuration used for your project or module, select - Run > Edit Configurations. See the section below about - Creating a Run Configuration for more information.
- -Be certain to create multiple AVDs upon which to test your application. You should have one - AVD for each platform and screen type with which your application is compatible. For instance, if - your application compiles against the Android 4.0 (API Level 14) platform, you should create an - AVD for each platform equal to and greater than 4.0 and an AVD for each screen type you support, then test your - application on each one.
- -Before you can run your application on a device, you must perform some basic setup for your - device:
- -android:debuggable attribute of the <application>
- element to true in the build.gradle file. Note: On Android 4.2 and newer, Developer - options is hidden by default. To make it available, go - to Settings > About phone and tap Build number - seven times. Return to the previous screen to find Developer options.
-Read Using Hardware Devices - for more information.
- -Once set up and your device is connected via USB, install your application on the device by - selecting Run > Run (or Run > - Debug) from the Android Studio menu bar.
- +
+
+
+ Figure 2. Click the link to locate the generated APK + files. +
\ No newline at end of file diff --git a/docs/html/tools/publishing/app-signing.jd b/docs/html/tools/publishing/app-signing.jd index 8f68ff72e6127..4b74f5ff81393 100644 --- a/docs/html/tools/publishing/app-signing.jd +++ b/docs/html/tools/publishing/app-signing.jd @@ -175,11 +175,23 @@ enter the passwords for both. Then click Next. width="349" height="232" style="margin-top:15px"/>Figure 2. Select a private key in Android Studio.
-On the next window, select a destination for the signed APK and click -Finish.
++ On the next window, select a destination for the signed APK(s), select the + build type, (if applicable) choose the product flavor(s), and click + Finish.
-Figure 3. Generate a signed APK in Android Studio.
++ Figure 3. Generate signed APKs for the selected product + flavors. +
++ Note: If your project uses product flavors, you can select + multiple product flavors while holding down the Ctrl key on + Windown/Linux, or the Command key on Mac OSX. Android Studio + will generate a separate APK for each selected product flavor. +
+