1. Foreword
As the saying goes, if you want to do your job well, you must first sharpen your tools. What can you do if you don’t use the tools well? With the update of Android Studio, I will introduce the updated content in the new version, as well as the useful settings in daily development.
2. About the new version
2.1, the latest official version
Android Studio Giraffe | 2022.3.1 Patch 1 Build #AI-223.8836.35.2231.10671973, built on August 17, 2023
The official version 2023.08.17 is still quite new.
2.2, version correspondence
Android Studio version | AGP version | API level Upper limit |
---|---|---|
Android Studio Giraffe | 3.2-8.1 | 33 |
2.3, download address
Giraffe:
https://developer.android.google.cn/studio
Download preview versions of Hedgehog and Lguana:
https://developer.android.google.cn/studio/preview
3. Enable New UI
3.1, About New UI
The redesigned theme is designed to reduce visual complexity, making it easier for users to access basic features and display complex features where appropriate, resulting in a modern, clean look and feel.
The main changes are as follows:
- Simplified main toolbar and added VCS, Project and Run widgets
- Tool windows have a new layout
- Added some new light themes and dark themes with contrasting and consistent color palettes
- A new icon set has been added to make it easier to identify
In short, it is four new
: new toolbar, new tool window, new theme, and new icon.
3.2, enable
Open the settings, there is an option New UI
under Appearance & Behavior
, apply and restart to experience the new interface theme of Android Studio (IntelliJ).
3.3. List of new interface themes
Visually, the overall style has changed quite a lot, mainly reflected in the icons, fonts, and colors, as well as the changes in the main menu bar at the top, the toolbars in the upper left, lower left, and upper right, and the navigation bar at the bottom.
3.3.1, Top main menu
- The first one on the left is the project name. Click to switch, which is more convenient than before. The second one on the left is Git Branch, which is Version Control. It associates branches and projects together. This is quite user-friendly and I like it very much;
- In the middle are the devices and run widgets;
- On the right is Project Compilation + Search + Settings + Account;
I saw someone on the Internet saying that the icon is too big and the “run” widget is too bright. Emmm, I think the whole thing is clearer.
3.3.2, Toolbar
Tool windows have three parts, upper left, lower left, and upper right.
Top left:
The upper left is Project + Resource Manager + some collapsed tools
- Project is collapsed by default, click to expand our project file list;
- Some tools are collected in **…
Lower left:
The lower left is Terminal, Logcat, etc. that were previously placed at the bottom.
Long press the icon to drag and sort, or drag it to the upper left, lower left, upper right, or lower right toolbar at will.
You can also put away those that are not commonly used. Right-click the icon and click Hide, and it will be placed in ···
Top right:
This area is mainly device management, Gradle, and third-party tools.
In addition, the original notifications at the bottom have been moved up. If you are not used to it, you can drag it to the toolbar in the lower right corner.
3.3.3, Navigation bar
The navigation bar that was originally at the top has been moved to the bottom.
If you are like me and are still used to the navigation bar at the top, you can set it in View > Appearance > Navigation Bar
:
3.3.4, compact mode
If you feel that the current style icons are too big and too spaced, and you develop using IntelliJ IDEA, you can set it on or off in View > Appearance > Compact Mode
, or Appearance and Behavior > New UI > enable the Compact mode option
.
However, this setting is only available in the new version of IntelliJ IDEA, not in Android Studio.
4. Editor Tab
The text and spacing in this part are larger than before. Although the official said it is “for better readability”, when only one line is displayed by default, if you open several files, you will not be able to find the first one. , or the files that do not want to be recycled are recycled and not displayed, which actually affects the efficiency.
So I usually set it to multiple lines (two lines),
Settings > Editor > General > Editor Tabs > Show tabs in > Multiple rows
:
5. Set JDK version
Recently, whether you are upgrading Android Studio or AGP, there will be problems with JDK version restrictions under mutual version constraints, or compilation errors caused by the default JDK 11 of the new version. Sometimes you need to change the JDK version of the compatible project. .
Settings > Build,Execution,Deployment > Build Tools > Gradle > Gradle JDK
:
6. Garbled code problem
Sometimes after upgrading to a new version, the Chinese comments in the file will be garbled. At this time, we need to manually modify the file encoding.
Settings > Editor > File Encodings
Don’t forget to set the encoding format of the properties
file as well.
7. Font size
After the update, I felt that the overall font size was too small. The default is 13. I personally adjusted it to 15 and it felt suitable on an external monitor.
The font size is divided into two parts, one for the IDE and one for the code.
IDE:
Settings > Appearance & amp; Behavior > Appearance > Font > Size
Code:
Settings > Editor > Font > Size
8. Logcat
New changes in Logcat are available in the Android Studio Dolphin
version. The biggest changes are the color of the log (Scheme) and the filtering of the log (Filter).
8.1、Scheme
The colors of log levels are clearer and easier to distinguish than before, and there is no need to customize settings anymore.
Of course, if you want, you can set it in Android Studio > Settings > Editor > Color Scheme
.
8.2, Filter
The default is package:mine
, which corresponds to your previous package name. Of course, it can be changed, Android Studio > Settings > Tools > Logcat
.
After the revision, the Filter uses key-value pairs to query:
tag
: Matches the tag field of the log entry.package
: Matches the package name of the logging application.process
: Matches the process name of the logging application.message
: Matches the message portion of the log entry.level
: Matches logs with a specified severity level or higher, such as DEBUG.age
: Matches if the entry timestamp is the most recent. Values are specified as a number followed by a letter that represents the unit of time: s for seconds, m for minutes, h for hours, and d for days. For example, age: 5m will only filter messages logged within the past 5 minutes.
There can be multiple query conditions, such as package + tag + level:
package:mine tag:yechaoa level:debug
Expressions can also be written for query conditions, supporting & amp;
|
and brackets
priorities, such as:
package:mine & amp; ( tag:yechaoa | level:debug )
etc…
Historical recording also supports Lenovo
, as long as you check this in the Logcat settings:
In addition, you can select Collection
for commonly used filtering statements, which will be displayed first in Show history
.
8.3, Buffer Size
If read: unexpected EOF!
often appears when you read logs and debug, it is because there are too many logs and the Logcat cache is exhausted.
You can choose clear
to try again. If it is still maxed out, you can add tag
to reduce redundant log output and be more efficient.
Of course, you can also set the buffer size of Logcat. The most common solution on the Internet is to use adb logcat -G 4m
or set the logger buffer size
in the developer options.
In fact, there is a simpler way, which is to set it in AS:
The default is 1024KB
.
9. Capitalization tips
If you are referencing a class or variable and the IDE does not prompt you because the input is in lowercase, you need to set matching case.
Mac:
Settings > Editor > General > Code Completion > Match case > Cancel
Win:
Settings > Editor > General > Code Completion > Case sensitive completion > None
10. File header
Generally, when creating a new class file, there will be a default File Header
, such as Created by xxx.
If you want to customize it, you can set it in Settings > Editor > File and Code Templates > Includes >File Header
11, far ahead version
An easter egg
I took advantage of Huawei’s traffic and changed the name of my AS. Many people asked how I did it, but it was actually very simple. .
Just application> rename
and reopen it.
12. Finally
This article will introduce these. In fact, every new version will update a lot of information, such as better support for Compose, better upgrade assistant, etc. For more information about the new version, you can also click on the Documentation
Address view.
13. Related documents
- Android Studio Giraffe | 2022.3.1
- IntelliJ IDEA New UI
- Main-changes-and-known-issues
- View logs with Logcat