The new Android Studio 4.0 has a brand new startup interface. Recently, the official beta version of Android Studio 3.5 was released at Google I/O, and the beta version of Android Studio 3.6 was released a month later. The recent Android Dev Summit brought us a preview version of Android Studio 4.0. Today we will take a look at what new experiences the new Android Studio 4.0 brings to developers! Next, I will introduce the latest developments of Android Studio 4.0 based on the content shared at the Android Dev Summit and my own understanding. If you haven't paid attention, please pay attention! If you find these articles interesting, please share, forward, comment and like them! Compilation and constructionThe latest progress, these new features are awesome">New Build window: After each build, a new Build Speed window will appear. In this window, we can view the time consumed by different plug-ins and tasks during the entire build period, and make targeted repairs. At the same time, it will also remind us which plug-ins are always executed during each build, helping us to find problems, reduce unnecessary plug-in execution, and shorten the build time. There are many categories here, and students who are interested can study them one by one. The latest progress, these new features are awesome">Now Android Studio 4.0 has improved the code hints for Kotlin Gradle DSL, and you can view the DSL documentation directly in the IDE. We all know that in the previous default Groovy writing, Android Studio will automatically help us check whether the existing dependent libraries have new versions, and now this feature is also retained for Kotlin Gradle DSL. The latest progress, these new features are awesome">On the compilation side, a new coreLibraryDesugaringEnabled true directive has been added. By turning on this directive, we can use some advanced APIs in Java 8. The latest progress, these new features are awesome">For example, as shown in the figure above, the list.stream() method can only be used on API 24 and above by default. By turning on coreLibraryDesugaringEnabled, the version restriction can be eliminated and this method can also be used on devices lower than API 24. Currently, this instruction supports java.util.stream, java.time, java.util.function, ConcurrentHashMap, etc. The purpose of this function is to solve the problem that persistent bugs caused by the inability to use Java advanced APIs on old versions cannot be fixed. The latest progress, these new features are awesome">The new Android Studio 4.0 provides syntax highlighting, code hints, and error checking when editing ProGuard files. At the same time, when refactoring the name, the corresponding fields in the ProGuard file will be updated in time. The latest progress, these new features are awesome">A new viewBinding directive has been added. When we turn it on and set it to true, the compiler will generate a view binding class for us, which is ActivityMainBinding in the figure below. The latest progress, these new features are awesome">The purpose of viewBinding is to ensure that the View we use in the code actually exists in the view. This prevents crashes caused by null findViewById. (However, I failed to enable it on 4.0 canary 1, probably because there is a bug.) ViewCurrently, we have three ways to write UI: XML, code-written custom View, and Jetpack Compose. Currently, all three methods support preview on Android Studio 4.0. The latest progress, these new features are awesome">The preview interface of the three is the same, divided into three modes: edit, preview, edit + preview. If nothing else, customizing View to support preview is really convenient, which can greatly improve development efficiency. The latest progress, these new features are awesome">In addition, the XML view preview supports simultaneous preview of multiple devices with different resolutions, and can also preview the layout of different languages during internationalization, as well as support for color blindness mode. (Of course, the latter two items have not appeared in 4.0 canary 1, but they are explained in the official demonstration video) The latest progress, these new features are awesome">Another cool thing is that Android Studio 4.0 supports embedded emulators. Note that the image interface in the picture above is not the preview interface we mentioned first, but a real emulator. You can develop on the left and debug on the right, and you no longer need to switch screens. The latest progress, these new features are awesome">Layout Inspector has also been updated. The previous Layout Inspector was similar to a layout snapshot. After switching interfaces, you need to restart the Layout Inspector. In Android Studio 4.0, Layout Inspector supports real-time automatic updates. When our device switches pages, the pages in the layout analyzer will also be updated. At the same time, the display of resource files is more complete, and the information display of the complete call chain is added. Another very cool feature (emphasis!) is that Layout Inspector supports 3D model inspection, as shown below: The latest progress, these new features are awesome">Although the official video says that these will appear in Android Studio 4.0, the canary 1 version I can download currently does not include custom View preview, embedded simulator, and new Layout Inspector. Subsequent canaries should gradually support this. Animation
After checking the official Demo, to be honest, this way of writing animations is still a bit cumbersome. Fortunately, Android Studio 4.0 supports a new animation editor, allowing us to create MotionLayout animations through visual operations. The latest progress, these new features are awesome">We can specify the layout in the start and end states, set the animation duration, and click the Transition line above to preview the animation. Isn't it very simple! And we can add keyframes at will during the duration, set the state of each frame, and control the animation effect in a more granular manner. Keyframes can set attributes and relative positions. With MotionLayout and the new animation editor, the only thing that limits you when making animations on Android is your imagination, not the API. otherThe latest progress, these new features are awesome">The new Resource Manager supports viewing and managing a variety of resources, such as images, colors, layouts, strings, animations, and more. The latest progress, these new features are awesome">The built-in Material Design Icon provides a variety of styles to choose from: filled, linear, two-color, rounded, rectangular, so you don’t have to cut the image yourself. The latest progress, these new features are awesome">The IDE has many built-in abbreviated code instruction templates to help us use them quickly. It also supports custom insertion. After reading this sharing, I realized that my use of Android Studio is still at the stage of knowing how to use it, and I have never studied it in depth. For example, I recently discovered that I can use File → New → Import Sample to view the official best practice code, which includes AAC architecture, animation, CameraX, NDK and various categories. The comments tell me that I should not be the last one to know this feature. The latest progress, these new features are awesome">The above is part of the latest developments in Android Studio at this Android Dev Summit. Of course, behind these features, the memory usage and compilation speed of the IDE itself have been greatly improved, otherwise the version number would not have jumped directly to 4.0. Think about it, Apple's Xcode has already released version 11, but Android Studio has only reached 4.0. It really takes time to do a good job. | Latest progress, these new features are really awesome">
>>: Mobile QQ 8.1.8 is officially launched: no more worry about losing chat records
3.15 How to make fake copywriting look real? Tomo...
According to foreign media reports, Tesla Electri...
This topic has been popular on the Internet for a...
Nowadays, WiFi has become an indispensable thing ...
Compiled by: Gong Zixin Obesity is a significant ...
Uncle Kai's Romance of the Three Kingdoms (Ep...
I often see people asking: "Why are the pict...
Written by Wei Shuihua Header image | TuChong Cre...
While people were still immersed in the joy of a ...
Before doing promotion, I think you should at lea...
Produced by: Science Popularization China Author:...
How did the first chemical reactions at the origi...
On July 4, Threads, a Twitter competitor develope...
After buying a Mercedes-Benz and driving it for t...
If you are an iPhone user, you may have discovere...