Should i update 4.2
Although the Android plugin is typically updated in lock-step with Android Studio, the plugin and the rest of the Gradle system can run independent of Android Studio and be updated separately.
For upcoming breaking changes in the Android Gradle plugin, see the Android Gradle plugin roadmap. For more information about the Gradle build system, see the Gradle user guide.
When you update Android Studio, you may receive a prompt to automatically update the Android Gradle plugin to the latest available version. You can choose to accept the update or manually specify a version based on your project's build requirements. The plugin version applies to all modules built in that Android Studio project. The following example sets the plugin to version 7.
Caution: You should not use dynamic dependencies in version numbers, such as 'com. Using this feature can cause unexpected version updates and difficulty resolving version differences. When you update Android Studio, you may receive a prompt to also update Gradle to the latest available version.
The following table lists which version of Gradle is required for each version of the Android Gradle plugin. For the best performance, you should use the latest possible version of both Gradle and the plugin. The following example sets the Gradle version to 7.
We are updating the version numbering for Android Gradle plugin AGP to more closely match the underlying Gradle build tool. The release after AGP 4. Every major release of AGP will require a major version upgrade in the underlying Gradle tool.
APIs will be deprecated approximately one year in advance, with replacement functionality made available concurrently. Deprecated APIs will be removed approximately one year later during the subsequent major update. Android Gradle plugin 7. This minor update includes various bug fixes. To see a list of notable bug fixes, read the related post on the Release Updates blog.
When using Android Gradle plugin 7. Android Studio Arctic Fox bundles JDK 11 and configures Gradle to use it by default, which means that most Android Studio users do not need to make any configuration changes to their projects.
The new Variant API is now stable. See the new interfaces in the com. As part of the new Variant API, we have made available a number of intermediate files, called artifacts, through the Artifacts interface. These artifacts, like the merged manifest, can be safely obtained and customized by using third-party plugins and code.
We will continue extending the Variant API by adding new functionalities and augmenting the number of intermediate artifacts we make available for customization.
For Android projects consisting of an app with library dependencies, it is recommended to set checkDependencies to true as shown below, and to run lint via. If a module's sources and resources have not changed, the lint analysis task for the module does not need to run again.
As a result, Lint can run even faster. The Lint report task also does not need to run if its inputs have not changed. AGP no longer supports running lint from dynamic-feature modules. In previous versions of AGP, it would run lint for all variants.
R8 more precisely and consistently handles missing classes and the -dontwarn option. Therefore, you should start to evaluate the missing class warnings emitted by R8. When R8 encounters a class reference that is not defined in your app or one of its dependencies, it will emit a warning that appears in your build output. For example:. This warning means that the class definition java. Two common reasons to ignore the warning are:. You can ignore a missing class warning by adding a -dontwarn rule to your proguard-rules.
Add the rules to your proguard-rules. In AGP 7. In AGP 8. It is possible to keep the AGP 7. Previously introduced in AGP 2. This change does not impact build time. To enable this feature, set compileOptions to the desired Java version and set compileSdkVersion to 30 or above:. In most cases, the AGP Upgrade Assistant will automatically migrate your project to the new configurations. If you are compiling against the Android Gradle plugin, your compile classpath may change.
If you depend on an AGP dependency at compile-time, be sure to add it as an explicit dependency. Previously, you could add a native library in a Java resources folder, and register the folder using android. Starting with AGP 7. Instead, use the DSL method intended for native libraries, android. For more information, see how to configure source sets.
Android Gradle Plugin 7. Projects that use the Kotlin Multiplatform support need to update to Kotlin 1. As a workaround, you can downgrade the Android Gradle plugin to 4. For more information, see KT There is no lint text output printed to stdout when the lint task is up-to-date issue For more context, see Behavior changes for lint.
This issue will be fixed in Android Gradle plugin 7. As a workaround, the lint task can be run on those libraries. Starting in version 4. Java 8 provides access to a number of newer language features including lambda expressions, method references, and static interface methods. For the full list of supported features see the Java 8 documentation.
To keep the old behavior, specify Java 7 explicitly in your module-level build. The new JVM resource compiler is enabled by default. Android Gradle Plugin 4. To enable one or both of these formats in your build, add the following properties to your module-level build.
This new flag takes care of the APK signing step in the deployment process. It is now possible to enable or disable app signing in Android Gradle plugin per variant. This example demonstrates how to set app signing per variant using the onVariants method in either Kotlin or Groovy:. To reduce clutter in build output, AGP 4. Previously, a line of output was generated for every file that was built, resulting in a large quantity of informational messages.
If you would like to see the entirety of the native output, set the new Gradle property android. You can set this property in either the gradle. Command line -Pandroid.
Starting in AGP 4. In other words, if you declare a property in a gradle. In AGP 4. This change reflects the new Gradle behavior and supports configuration caching. For more information on setting values in gradle. In previous releases, JDK 8 was bundled with Studio. When using the new bundled JDK to run Gradle, this may result in some incompatibility or impact JVM performance due to changes to the garbage collector. These issues are described below.
Android Studio 4. For more information about Gradle compatibility, see Update Gradle. To get started, download Android Studio on your compatible Chrome OS device and follow the installation instructions. Conditional delivery allows you to set certain device configuration requirements for feature modules to be downloaded automatically during app install.
For example, you can configure a feature module that includes functionality for augmented reality AR to be available at app install for only devices that support AR.
This delivery mechanism currently supports controlling the download of a module at app install-time based on the following device configurations:. If a device does not meet all the requirements you specify, the module is not downloaded at app install-time. However, your app may later request to download the module on demand using the Play Core Library. To learn more, read Configure conditional delivery.
The last IntelliJ version that was included with Android Studio was For more information about the improvements from other IntelliJ versions that are included cumulatively with this release of Android Studio, see the following bug-fix updates:. In particular, we'd like to thank the following people who reported P0 and P1 bugs:. The new Project Structure Dialog PSD makes it easier to update dependencies and configure different aspects of your project, such as modules, build variants, signing configurations, and build variables.
You can find descriptions of some of the new and updated sections of the PSD below. The new variables section of the PSD allows you to create and manage build variables, such as those to keep version numbers for dependencies consistent across your project. Configure properties that are applied to all build variants in an existing module or add new modules to your project from the Modules section.
For example, this is where you can configure defaultConfig properties or manage signing configurations. Inspect and visualize each dependency in the dependency graph of your project, as resolved by Gradle during project sync, by following these steps:.
Depending on the type of dependency you select, you should see a dialog, similar to the one below, that helps you add the dependency to the module.
In this section of the PSD, create and configure build variants and product flavors for each module in your project. You can add manifest placeholders, add ProGuard files, and assign signing keys, and more.
See suggested updates for project dependencies and build variables in the Suggestions section, as shown below. Resource Manager is a new tool window for importing, creating, managing, and using resources in your app. The Resource Manager allows you to do the following:. To learn more, read the guide about how to Manage app resources.
When you provide debugging symbol files for the. If you build the native libraries in your APK with a build ID, Android Studio checks whether the build ID in your symbol files matches the build ID in your native libraries and rejects the symbol files if there is a mismatch. If you did not build with a build ID, then providing incorrect symbol files may cause problems with debugging. R8 integrates desugaring, shrinking, obfuscating, optimizing, and dexing all in one step—resulting in noticeable build performance improvements.
R8 was introduced in Android Gradle plugin 3. Now, with R8, desugaring, shrinking, obfuscating, optimizing, and dexing D8 are all completed in one step, as illustrated below.
So, in this unlikely situation, you might need to add additional rules to keep that code in your build output. All argument types supported by the Navigation component are now supported in the Navigation Editor.
For more information on supported types, see Pass data between destinations. The Attributes pane in the Layout Editor has been streamlined into a single page with sections you can expand to reveal attributes you can configure. The Attributes pane also includes the following updates:. For example, if you reference the WorkManager class without first importing the required android. In particular, because Jetpack repackaged the support library into discrete packages that are easier to manage and update, this intention action helps you quickly add only the dependencies you need for the Jetpack components you want to use.
The Navigation Editor lets you quickly visualize and build navigation into your app by using the Navigation Architecture Component. For more information, see Implement navigation with the Navigation Architecture Component.
The Delete Unused Android Studio Directories dialog then displays locations, sizes, and last-modified times of these unused directories and provides an option to delete them. Lint, when invoked from Gradle, is significantly faster—larger projects can expect lint to run up to four times faster.
The Create New Project wizard has a new look and contains updates that help streamline the creation of new Android Studio projects. Based on user feedback, rendering performance while using the profilers has been greatly improved.
Please continue to provide feedback , especially if you continue to see performance issues. To improve app performance while profiling, the Memory Profiler now samples memory allocations periodically by default. If desired, you can change this behavior by using the Allocation Tracking dropdown when testing on devices running Android 8. Using the Allocation Tracking dropdown, you can choose from the following modes:.
Off: turns memory allocation off. If not already selected, this mode is enabled automatically while taking a CPU recording and then returned to the previous setting when the recording is finished.
You can change this behavior in the CPU recording configuration dialog. This data might be useful when investigating bottlenecks that cause UI jank and low framerates.
For example, each frame that takes longer than the 16ms required to maintain a smooth framerate is displayed in red. To see frame rendering data, record a trace using a configuration that allows you to Trace System Calls. After recording the trace, look for info about each frame along the timeline for the recording under the section called FRAMES , as shown below. To learn more about investigating and fixing framerate issues, read Slow rendering. The event timeline now shows when fragments are attached and detached.
Additionally, when you hover over a fragment, a tooltip shows you the fragment status. Previously, the Network profiler displayed only raw text from connection payloads. In the Response and Request tabs, click the View Parsed link to display formatted text, and click the View Source link to display raw text.
For more information, see Inspect network traffic with Network Profiler. For more information, see Auto-download missing packages with Gradle. Android Studio now includes support for static code analysis using Clang-Tidy for projects that include native code.
When selecting this inspection in the Settings or Preferences dialog, you can also see the list of Clang-Tidy checks that are enabled and disabled under the Option section of the right-most panel.
To enable additional checks , add them to the list and click Apply. CMake version 3. Note that Gradle still uses version 3. For more information on configuring CMake in build. In other words, you can now build and deploy both installed app and instant experiences from a single Android Studio project and include them in a single Android App Bundle. Syncing your project with your build configuration is an important step in letting Android Studio understand how your project is structured.
However, this process can be time-consuming for large projects. If your project uses multiple build variants, you can now optimize project syncs by limiting them to only the variant you have currently selected. You need to use Android Studio 3. When you meet these requirements, the IDE prompts you to enable this optimization when you sync your project. The optimization is also enabled by default on new projects. For more information, see Enable single-variant project sync.
If you've opted into sharing usage statistics to help improve Android Studio, you'll see these two new icons in the status bar at the bottom of the IDE window:. Simply click the icon that best represents your current experience with the IDE.
When you do so, the IDE sends usage statistics that allow the Android Studio team to better understand your sentiment. In some cases, such as when you indicate a negative experience with the IDE, you'll have an opportunity to provide additional feedback.
Kotlin version 1. Although you typically don't need to specify the build tools version, when using Android Gradle plugin 3. The assistant opens when you start Android Studio after a fresh installation or update if it detects that there is new information to show.
Android Jetpack helps to accelerate Android development with components, tools, and guidance that eliminate repetitive tasks and enable you to more quickly and easily build high-quality, testable apps. Android Studio includes the following updates to support Jetpack. For more information, see the Jetpack documentation. The new Navigation Editor integrates with the navigation components of Android Jetpack to provide a graphical view for creating the navigation structure of your app.
The Navigation Editor simplifies the design and implementation of navigation between in-app destinations. In Android Studio 3. To learn more, read the Navigation Editor documentation.
As part of Jetpack, we are migrating the Android Support Libraries to a new Android extension library using the androidx namespace. For more information, see the AndroidX overview. If you have any Maven dependencies that have not migrated to the AndroidX namespace, the Android Studio build system also automatically converts those project dependencies. The Android Gradle plugin provides the following global flags that you can set in your gradle.
Both flags are set to true when you use the Migrate to AndroidX command. If you want to start using AndroidX libraries immediately and don't need to convert existing third-party libraries, you can set the android. You no longer need to build, sign, and manage multiple APKs, and users get smaller, more optimized downloads. Additionally, you can add feature modules to your app project and include them in your app bundle. For more information, including instructions for building and analyzing an Android App Bundle, see Android App Bundle.
Many Android layouts have runtime data that can make it difficult to visualize the look and feel of a layout during the design stage of app development. You can now easily see a preview of your view in the Layout Editor filled with sample data. When you add a view, a button appears below the view in the Design window.
Click this button to set the design-time view attributes. You can choose from a variety of sample data templates and specify the number of sample items with which to populate the view.
To try using sample data, add a RecyclerView to a new layout, click the design-time attributes button below the view, and choose a selection from the carousel of sample data templates. Slices provide a new way to embed portions of your app's functionality in other user interface surfaces on Android. For example, Slices make it possible to show app functionality and content in Google Search suggestions. To learn more, including how to test your Slice interactions, read the Slices getting started guide.
For more information, see the Android Developers blog. Try the following new Android Profiler features in Android Studio 3. You can now save Profiler data as sessions to revisit and inspect later. The profiler keeps your session data until you restart the IDE. When you record a method trace or capture a heap dump , the IDE adds that data along with your app's network activity as a separate entry to the current session, and you can easily switch back and forth between recordings to compare data.
This trace configuration is built on systrace and is useful for investigating system-level issues, such as UI jank. If you deploy your app to a device running Android 8. While your app is running, select a portion of the timeline that you want to inspect and select JNI heap from the drop-down menu above the class list, as shown below. You can then inspect objects in the heap as you normally would and double-click objects in the Allocation Call Stack tab to see where the JNI references are allocated and released in your code.
You can now import, export, and inspect. Import your. You can then inspect its data in the Memory Profiler as you would any other heap dump. To save heap dump data to review later, use the Export Heap Dump button at the right of the Heap Dump entry in the Sessions pane. In the Export As dialog that appears, save the file with the. You can now import and inspect.
Currently, you can't import System Trace recordings. You can then inspect its data in the CPU Profiler similar to how you normally would, with the following exceptions:. After you deploy your app to a device, the profiler automatically starts recording CPU activity when your app calls startMethodTracing String tracePath , and the profiler stops recording when your app calls stopMethodTracing. The Energy Profiler displays a visualization of the estimated energy usage of your app, as well as system events that affect energy usage, such as wakelocks, alarms, and jobs.
The Energy Profiler appears as a new row at the bottom of the Profiler window when you run your app on a connected device or Android Emulator running Android 8. Click the Energy row to maximize the Energy Profiler view.
Place your mouse pointer over a bar in the timeline to see a breakdown of energy use by CPU, network, and location GPS resources, as well as relevant system events. System events that affect energy usage are indicated in the System timeline below the Energy timeline.
Details of system events within the specified time range are shown in the event pane when you select a time range in the Energy timeline. To see the call stack and other details for a system event, such as a wakelock, select it in the event pane. To go to the code responsible for a system event, double-click the entry in the call stack. The new lint checks help you to find and identify common code problems, ranging from warnings about potential usability issues to high-priority errors regarding potential security vulnerabilities.
To make sure that your Java code interoperates well with your Kotlin code, new lint checks enforce the best practices described in the Kotlin Interop Guide. Examples of these checks include looking for the presence of Nullability annotations, use of Kotlin hard keywords, and placing lambda parameters last. To enable these checks for command-line builds, add the following to your build. New lint checks for Slices help to ensure that you are constructing Slices correctly. For example, lint checks warn you if you have not assigned a primary action to a Slice.
Use the new lintFix Gradle task to apply all of the safe fixes suggested by the lint check directly to the source code. An example of a lint check that suggests a safe fix to apply is SyntheticAccessor. Various metadata, such as the service cast check, have been updated for lint checks to work with Android 9 API level Lint now records which variant and version a baseline is recorded with, and lint warns you if you run it on a different variant than the one with which the baseline was created.
For example, the resource cycle checks now apply to additional resource types, and the translation detector can find missing translations on the fly, in the editor.
Issue IDs are now shown in more places now, including in the Inspection Results window. This makes it easier for you to find the information that you need to enable or disable specific checks through lintOptions in build.
For more information, see Configure lint options with Gradle. Data Binding V2 is now enabled by default and is compatible with V1. This means that, if you have library dependencies that you compiled with V1, you can use them with projects using Data Binding V2.
However, note that projects using V1 cannot consume dependencies that were compiled with V2. R8 is a new tool for code shrinking and obfuscation that replaces ProGuard. When using the Project window in previous versions of Android Studio, you could navigate and inspect only the header files that belong to libraries you build from a local project. Previous versions of Android Studio enabled native multidex when deploying the debug version of an app to a device running Android API level 21 or higher.
Beginning with Android Studio 3. To use AAPT2, make sure that you have a google dependency in your build. Android Studio no longer passes the --configure-on-demand argument to Gradle. The ADB Connection Assistant provides instructions, in-context controls, and a list of connected devices in a series of pages in the Assistant panel.
You can now save and load snapshots of an AVD Android virtual device at any time in the Android Emulator, making it fast and easy to return an emulated device to a known state for testing.
Controls for saving, loading, and managing AVD snapshots are now in the Snapshots tab in the emulator's Extended controls window. Builds configured with source sets failed with the following message when Instant Run was enabled:. Build failures occurred during dexing in some projects with large numbers of modules or external dependencies, with the following error message:. This update also includes changes that make running lint checks from Gradle much faster in some scenarios.
In some cases, when a project created in Android Studio 3. The result was that projects did not build when the Run or Debug button was clicked, which in turn caused failures such as deployment of incorrect APKs and crashes when using Instant Run.
To solve this problem, Android Studio 3. This modification occurs after the first Gradle sync when the project is loaded. Improvements include better control flow analysis for collections and strings, improved nullability inference, new quick fixes, and much more. When you use the Room database library , you can take advantage of several improvements to SQL editing:. This update includes several improvements for data binding :.
You can now use a LiveData object as an observable field in data binding expressions. The ObservableField class can now accept other Observable objects in its constructor.
You can preview a new incremental compiler for your data binding classes. For details of this new compiler and instructions for enabling it, see Data Binding Compiler V2. Libraries keep their generated binding classes when the app is compiled, rather than being regenerated each time.
This can greatly improve performance for multi-module projects. You don't need to make any changes to your code or your development workflow to get these benefits, unless you had previously manually disabled the D8 compiler.
Asked 5 months ago. Active 5 months ago. Viewed times. TheJakester42 TheJakester42 39 2 2 bronze badges. Add a comment. Active Oldest Votes. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. If you want to maintain a stable version of Android Studio, you can run the stable release version and canary release versions of Android Studio Arctic Fox at the same time. Learn more. We appreciate any feedback on things you like, and issues or features you would like to see.
If you find a bug or issue, feel free to file an issue.
0コメント