In the midst of a pandemic, Google finally released its stable version of Android Studio 4.0 on May 28, 2020.
在大流行中,谷歌终于在2020年5月28日发布了其稳定版本的Android Studio 4.0。
Every release brings its own interesting updates and bug fixes that help developers code smarter and develop apps faster than ever. And Android studio 4.0 is no exception.
每个发行版都有自己有趣的更新和错误修复,可帮助开发人员以前所未有的速度更智能地编码和开发应用程序。 Android Studio 4.0也不例外。
In this article we will learn about some of the exciting features that Android studio 4.0 brings to the table that will help developers out a lot.
在本文中,我们将学习Android Studio 4.0带来的一些令人兴奋的功能,这些功能将对开发人员有很大帮助。
You can get a direct link to download Android Studio 4.0 by clicking here for your Windows, Mac, and Linux machines.
你可以得到一个直接链接到下载的Android 4.0工作室点击这里为您的Windows,Mac和Linux机器。
Here are some highlights of the release notes:
以下是发行说明的一些要点:
Android Studio 4.0 introduces a plethora of interesting features, including
Android Studio 4.0引入了许多有趣的功能,包括
Let’s take an in-depth look at the fun new features of Android Studio 4.0.
让我们深入研究Android Studio 4.0的有趣新功能。
Following is a list of new features along with some info about how they work and why they're great.
以下是新功能的列表,以及有关它们如何工作以及其出色之处的一些信息。
The Motion Editor upgrades the visual design editor for motion layout and it also generates XML. MotionLayout is a subpart of ConstraintLayout that helps developers manage widget and motion animation in mobile applications.
动作编辑器将视觉设计编辑器升级为动作布局,并且还会生成XML。 MotionLayout是ConstraintLayout的子部分,可帮助开发人员管理移动应用程序中的小部件和运动动画。
It has a visual design editor that helps you create, edit, and preview your animations without developing the application. It also allows you to play/pause animations for debugging.
它具有可视化设计编辑器,可帮助您创建,编辑和预览动画,而无需开发应用程序。 它还允许您播放/暂停动画以进行调试。
Motion layout takes the place of the previous constraint layout and improves it. It helps Android app developers animate between layout states and manage critical animations easily.
运动布局取代了之前的约束布局并对其进行了改进。 它可以帮助Android应用开发者在布局状态之间进行动画处理,并轻松管理关键动画。
You can now deploy the the Motion Layout API with the advanced Motion Editor to develop or edit an animation while everything is stored in an XML file.
现在,您可以使用高级运动编辑器部署运动布局API ,以在所有内容都存储在XML文件中的同时开发或编辑动画。
The only difference is that you don't need to write it out manually because everything is now be managed by the Motion Editor. You can easily preview your animations and make any changes.
唯一的区别是,您无需手动将其写出,因为现在所有内容都由Motion编辑器进行管理。 您可以轻松预览动画并进行任何更改。
Android Studio 4.0 now allows developers to have real-time insights into their mobile applications’ UI. This means now you can visualize how your application will be laid out on-screen along with various features.
Android Studio 4.0现在允许开发人员实时了解其移动应用程序的UI。 这意味着现在您可以可视化如何将您的应用程序以及各种功能显示在屏幕上。
It also has a dynamic layout hierarchy that gets updated with each refresh, and has detailed view attributes that help you determine resource values.
它还具有动态布局层次结构,该结构随每次刷新而更新,并具有详细的视图属性,可帮助您确定资源值。
You can deploy the feature by selecting View> Tool Windows> Layout Inspector from the main menu.
您可以通过从主菜单中选择“ 视图”>“工具窗口”>“布局检查器”来部署功能。
If you are deploying an app to a device running on the API level 29 or higher, then you can access some additional features like a dynamic layout. There's a lot of detailed information on the Layout Inspector to check out as well.
如果要将应用程序部署到运行在API级别29或更高级别的设备上,则可以访问一些其他功能,例如动态布局。 在Layout Inspector上也有很多详细的信息可以检出。
Its property value resolution feature allows you to learn the origin of the property in the source code. It also navigates you to its location using the hyperlink. You can leverage the benefit of 3D representation if your application or device is running on Android API 29 or more.
它的属性值解析功能使您可以在源代码中了解属性的来源。 它还使用超链接将您导航到其位置。 如果您的应用程序或设备运行在Android API 29或更高版本上,则可以利用3D表示的优势。
Developers can now deploy a 3D representation of the on-screen animation and inspect the other attributes. So, when you hire a developer to revamp your app interface or add in new features, you don’t have to worry about the look of the app with modern UX/UI design typography as you can check simultaneously during coding.
开发人员现在可以部署屏幕动画的3D表示并检查其他属性。 因此,当您雇用开发人员修改应用程序界面或添加新功能时,您不必担心具有现代UX / UI设计字体的应用程序外观,因为您可以在编码过程中同时进行检查。
You can now produce layouts in various devices and configure them at the same time without any interruption. Layout Validation or Layout Multi preview are visual tools.
现在,您可以在各种设备中制作布局并同时配置它们而不会受到任何干扰。 布局验证或布局多预览是视觉工具。
Previously, when creating a layout in Android studio, switching between different screen sizes and resolutions in preview mode was challenging. But with these latest updates, it's a lot simpler.
以前,在Android Studio中创建布局时,在预览模式下在不同的屏幕尺寸和分辨率之间进行切换非常困难。 但是有了这些最新更新,它变得简单得多。
How so? Well, you just need to choose the pixel devices and then you can easily check or preview the changes in the integrated development environment.
为何如此? 好了,您只需要选择像素设备,然后就可以轻松地检查或预览集成开发环境中的更改。
You can also use this tool to identify possible issues in the UI as you're often designing a UI for a particular configuration or visible screen size.
当您经常为特定配置或可见屏幕尺寸设计UI时,也可以使用此工具在UI中识别可能的问题。
You can access this tool by clicking on the Layout Validation tab in the top right corner of the IDE window.
您可以通过单击IDE窗口 右上角的“ 布局验证”选项卡来访问此工具。
Android Studio 4.0 introduced a Build Analyzer tool that helps developers analyze and handle build-related issues. Application development time has always represented a lot of overhead for Android devs.
Android Studio 4.0引入了构建分析器工具,可帮助开发人员分析和处理与构建相关的问题。 应用程序开发时间一直代表着Android开发人员的大量开销。
This new feature quickly mitigates lost time and productivity by recognising outdated and misconfigured jobs. The build analyzer tool shows your jobs and plugins and suggests ways to reduce regressions.
通过识别过时和配置错误的作业,此新功能可以快速减轻浪费的时间和生产力。 构建分析器工具显示您的工作和插件,并提出减少回归的方法。
This also helps with another problem – before, developers didn't know exactly which part of the build system was taking more time. Not the case now.
这也有助于解决另一个问题-以前,开发人员并不确切知道构建系统的哪一部分需要花费更多时间。 现在不是这样。
So the new grade plug-in 4.0 helps developers analyze and find the issue, such as improperly configured tasks, in the build process. You can easily specify the default settings by including one or more of the lines below in each modules’ build.gradle file.
因此,新等级的插件4.0可帮助开发人员在构建过程中分析和查找问题,例如配置不正确的任务。 您可以通过在每个模块的build.gradle文件中包含以下一行或多行内容来轻松指定默认设置。
Build analyzer also helps you address and understand bottlenecks in your build by calling out the plug-ins and tasks that are most important for overall application build time. It then gives you some steps to mitigate regressions.
构建分析器还可以通过调出对整个应用程序构建时间最重要的插件和任务来帮助您解决和理解构建中的瓶颈。 然后为您提供一些减轻回归的步骤。
Another super annoying part of Android app development has been trying to deploy Java 8 features. You may find some code that uses a Stream or want to implement a lambda function or there may even be a Java 8 API that you require which isn't practical to work around.
Android应用程序开发的另一个超级烦人的部分一直在尝试部署Java 8功能。 您可能会发现一些使用Stream的代码或想要实现lambda函数的代码,或者甚至可能需要使用Java 8 API来解决。
But with the Android Gradle plugin, you can compile certain Java 8 features with your older APIs.
但是,借助Android Gradle插件,您可以使用旧版API编译某些Java 8功能。
And Android Studio 4.0 enables the desugaring engine to provide support to Java languages.
而Android Studio 4.0则使该功能强大的引擎能够提供对Java语言的支持。
Developers leveraging Android Studio 4.0 can enable and disable build features, such as view binding, data binding, or auto-generated BuildConfig classes.
利用Android Studio 4.0的开发人员可以启用和禁用构建功能,例如视图绑定,数据绑定或自动生成的BuildConfig类。
Also, you may not require these plugins and libraries for each and every project, so you can disable the libraries/plugins and surge the scalability for big projects.
另外,您可能不需要为每个项目都使用这些插件和库,因此可以禁用库/插件并提高大型项目的可伸缩性。
Kotlin is one of the most used technologies among android programmers in India, and this feature will likely encourage its adoption for faster app development in the future.
Kotlin是印度android程序员中最常用的技术之一,此功能很可能会鼓励其被采用,以在将来更快地进行应用程序开发。
R8 was introduced in Android Gradle plug-in 3.4.0 to combine shrinking, desugaring, dexing, and obfuscating all in one step. This resulted in improved build performance.
R8是在Android Gradle插件3.4.0中引入的,可将收缩,除糖,脱色和模糊处理全部合并到一个步骤中。 这样可以提高构建性能。
Previously, there was no support for a smart editor that offered auto-suggestions while writing R8 rules. But with Android Studio 4.0, a smart editor can write the rules for code shrinking.
以前,不支持在编写R8规则时提供自动建议的智能编辑器。 但是使用Android Studio 4.0,智能编辑器可以编写代码缩减规则。
When developing rules files for R8, Android Studio now offers various features, including completion, syntax highlighting, and error-checking.
在为R8开发规则文件时,Android Studio现在提供各种功能,包括完成,语法突出显示和错误检查。
This editor smoothly works with your project to offer full symbol completion for all models, classes, and fields and also includes refactoring and navigation.
该编辑器可以顺利地与您的项目一起使用,以为所有模型,类和字段提供完整的符号补全,还包括重构和导航。
New fragment templates and fragment wizards are now available in the navigation editor.
现在,导航编辑器中提供了新的片段模板和片段向导。
These templates allow developers to quickly navigate fragment wizard content to creating slideshows using ViewPager (which is available in the support library). This tool lets you easily set up slide animation and enhances the app's look and feel.
这些模板使开发人员可以快速浏览片段向导的内容,以使用ViewPager (在支持库中)创建幻灯片。 该工具可让您轻松设置幻灯片动画,并增强应用程序的外观。
These updates have made it easier for developers to implement an animated default screen slide through simple drag & drop templates available in the navigation editor. And there's less coding involved, too.
这些更新使开发人员更容易通过导航编辑器中提供的简单拖放模板来实现动画默认屏幕幻灯片。 而且涉及的编码也更少。
Basically, Fragment is a class in Android that allows the integration of a UI that's adaptable to different device screen orientations. It combines different types of segments into a single screen element.
基本上,Fragment是Android中的一类,该类允许集成适用于不同设备屏幕方向的UI。 它将不同类型的段组合到单个屏幕元素中。
The introduction of templates into Fragment Wizard makes using these different features pretty effortless. And it's definitely a bonus when your mobile app's UI adapts to different screen sizes and orientations.
在Fragment Wizard中引入模板使使用这些不同功能变得毫不费力。 当您的移动应用程序的UI适应不同的屏幕尺寸和方向时,这绝对是一种奖励。
The latest version of Android Studio has built-in support for Kotlin DSLscript files. You can easily use the full suite of quick fixes that are supported by the project structure dialogue. Android Studio now has Android-specific live templates for Kotlin code.
最新版本的Android Studio内置了对Kotlin DSLscript文件的支持。 您可以轻松地使用项目结构对话框所支持的全套快速修复程序。 Android Studio现在具有Kotlin代码专用于Android的实时模板。
For instance, simply type “toast” and press the Tab Key to swiftly insert boilerplate code for a Toast.
例如,只需键入“ toast” ,然后按Tab键即可快速插入Toast的样板代码。
For a full list of live templates, navigate to Editor> Live templates in the settings (or preferences) dialogue.
有关实时模板的完整列表,请在设置(或首选项)对话框中导航至“ 编辑器”>“实时模板 ”。
CPU Profilers are one of the best new features in Android Studio – especially when it comes to performance. The CPU profiler is designed to give you information related to trace recording and your app’s thread activity.
CPU Profiler是Android Studio中最好的新功能之一-尤其是在性能方面。 CPU探查器旨在为您提供与跟踪记录和应用程序的线程活动有关的信息。
Before, all the profilers’ data used to display under one section:
以前,所有探查器的数据都用于显示在一个部分下:
With Android Studio 4.0, CPU recordings can be set aside from the main profiler timeline and managed in groups to allow easier analysis. Developers can easily drag-and-drop and move groups up and down individual items within a group for further customization.
使用Android Studio 4.0,可以在主探查器时间轴旁设置CPU记录,并按组进行管理,以简化分析。 开发人员可以轻松地在组中的各个项目之间上下移动组,以进行进一步的自定义。
In addition, for smooth side-by-side analysis, you can inspect all thread activity in the Thread Activity timeline (including functions, methods, and events) and try the latest navigation shortcuts to move around data.
此外,为了进行顺畅的并排分析,您可以检查“线程活动”时间轴中的所有线程活动(包括函数,方法和事件),并尝试使用最新的导航快捷方式来移动数据。
The System Trace UI was also upgraded so that the events can be uniquely coloured for improved visual distinctions. Threads can also be sorted to surface the busier ones based on priority, and you can focus more on seeing data for only the threads you have selected rather than all combined data.
系统跟踪用户界面也进行了升级,以便可以对事件进行独特的着色,以改善视觉效果。 还可以根据优先级对线程进行排序以显示繁忙的线程,并且您可以将更多的精力集中在仅查看所选线程而不是所有组合数据的数据上。
For detail description on CPU Profiler click here.
有关CPU Profiler的详细说明, 请单击此处 。
Android Studio 4.0 lets developers designate which dynamic feature module is dependent on another feature module. By deploying this, you can check if the app has sufficient modules to improve the functionality of your applications.
Android Studio 4.0使开发人员可以指定哪个动态功能模块依赖于另一个功能模块。 通过部署它,您可以检查应用程序是否具有足够的模块来改进应用程序的功能。
For example, if a user records a video, then the computer module automatically gets downloaded. This is because the video module depends on the camera module.
例如,如果用户录制了视频,则计算机模块将自动下载。 这是因为视频模块取决于摄像头模块。
These are the features of Android Studio 4.0 that will really help improve the performance of your Android applications. They'll also help Android app developers code more quickly and efficiently.
这些是Android Studio 4.0的功能,它们将真正帮助您改善Android应用程序的性能。 他们还将帮助Android应用开发者更快速,更高效地编码。
Currently, creating Android apps is a major investment interest among both entrepreneurs and enterprises.
当前,创建Android应用程序是企业家和企业之间的主要投资兴趣。
Thus, there is huge competition among businesses to choose an android app development company that's up to speed on modern technology verticals and that can create valuable products.
因此,选择一家Android应用程序开发公司的企业之间存在激烈的竞争 这是在现代技术垂直市场上的最高速度,并且可以创造出有价值的产品。
The launch of Android 4.0 will make things a whole lot easier and more interesting for everyone.
Android 4.0的发布将使所有人的工作变得更加轻松和有趣。
翻译自: https://www.freecodecamp.org/news/android-studio-4-updates/