- The Android Game Developer's Handbook
- Avisekhar Roy
- 539字
- 2021-07-14 10:29:00
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 modulemanifests/
: Manifest files for the moduleres/
: Resource files for the moduleGradle 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.

- 少兒人工智能趣味入門:Scratch 3.0動畫與游戲編程
- Advanced Machine Learning with Python
- Android項目開發(fā)入門教程
- ASP.NET Core 2 and Vue.js
- The React Workshop
- Magento 2 Development Cookbook
- UML 基礎(chǔ)與 Rose 建模案例(第3版)
- Getting Started with Hazelcast(Second Edition)
- BeagleBone Black Cookbook
- Visual Basic程序設(shè)計
- BeagleBone Robotic Projects(Second Edition)
- 自學(xué)Python:編程基礎(chǔ)、科學(xué)計算及數(shù)據(jù)分析(第2版)
- 從“1”開始3D編程
- C# 7.0本質(zhì)論
- 系統(tǒng)分析師UML用例實戰(zhàn)