官术网_书友最值得收藏!

Android Studio

Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. On top of the capabilities you expect from IntelliJ, Android Studio offers the following among many others:

  • Flexible Gradle-based build system
  • Build variants and multiple .apk file generation
  • Code templates to help you build common app features
  • Rich layout editor with support for drag and drop theme editing
  • lint tools to catch performance, usability, version compatibility, and other problems
  • ProGuard and app-signing capabilities
  • Built-in support for the Google Cloud platform, making it easy to integrate Google Cloud messaging and App Engine

If you're new to Android Studio or the IntelliJ IDEA interface, this section provides an introduction to some key Android Studio features.

Android project view

By default, Android Studio displays your project files in the Android project view. This view shows a flattened version of your project's structure, which provides quick access to the key source files of Android projects, and helps you work with the Gradle-based build system. The Android project view:

  • Shows the most important source directories at the top level of the module hierarchy
  • Groups the build files for all modules in a common folder
  • Groups all the manifest files for each module in a common folder
  • Shows resource files from all Gradle source sets
  • Groups resource files for different locales, orientations, and screen types in a single group per resource type

The Android project view shows all the build files at the top level of the project hierarchy under Gradle Scripts. Each project module appears as a folder at the top level of the project hierarchy, and contains these four elements at the top level:

  • java/: Source files for the module
  • manifests/: Manifest files for the module
  • res/: Resource files for the module
  • Gradle Scripts/: Gradle build and property files

Note

For example, the Android project view groups all the instances of the ic_launcher.png resource for different screen densities under the same element.

The project structure on disk differs from this flattened representation. To switch back to the segregated project view, select your project from the Project drop-down menu.

Memory and CPU monitor

Android Studio provides a memory and CPU monitor view so that you can easily monitor your app's performance and memory usage to track CPU usage, find deallocated objects, locate memory leaks, and track the amount of memory the connected device is using. With your app running on a device or emulator, click on the Android tab in the lower-left corner of the runtime window to launch the Android runtime window. Click on the Memory | CPU tab.

When you're monitoring memory usage in Android Studio, you can initiate garbage collection, and dump the Java heap to a heap snapshot in an Android-specific HPROF binary format file at the same time. The HPROF viewer displays classes, instances of each class, and a reference tree to help you track memory usage and find memory leaks.

Android Studio allows you to track memory allocation as it monitors memory use. Tracking memory allocation allows you to monitor where objects are being allocated when you perform certain actions. Knowing these allocations enables you to adjust the method calls related to those actions to optimize your app's performance and memory use.

主站蜘蛛池模板: 沾益县| 汾阳市| 绵竹市| 崇仁县| 梁河县| 绥芬河市| 平安县| 宝清县| 石首市| 曲靖市| 朝阳区| 万年县| 辉县市| 会泽县| 纳雍县| 阿图什市| 社会| 通化市| 内黄县| 临泽县| 阿瓦提县| 抚顺市| 平乡县| 阿拉善左旗| 定远县| 昔阳县| 维西| 镇远县| 新密市| 普陀区| 玛多县| 太湖县| 房产| 湟源县| 凉山| 常宁市| 玛纳斯县| 天峨县| 台北县| 海宁市| 平顶山市|