AndroidStudio3.0 Download Use new features Introduction

Source: Internet
Author: User
Tags new set android sdk manager

Google's 2017 conference updated a lot of content, but also released a preview version of AndroidStudio3.0, some features sneak peek. (in English, some translations are not very good)

Https://developer.android.google.cn/studio/archive.html

Select 显示全部 to see, here are given.

    • Windows (64-bit): Android-studio-ide-171.4010489-windows.zip (702075896 bytes)
      Https://dl.google.com/dl/android/studio/ide-zips/3.0.0.0/android-studio-ide-171.4010489-windows.zip

    • Windows (32-bit): Android-studio-ide-171.4010489-windows32.zip (701541040 bytes)

    • Mac:android-studio-ide-171.4010489-mac.zip (701134644 bytes)
      Https://dl.google.com/dl/android/studio/ide-zips/3.0.0.0/android-studio-ide-171.4010489-mac.zip

    • Linux:android-studio-ide-171.4010489-linux.zip (700534332 bytes)
      Https://dl.google.com/dl/android/studio/ide-zips/3.0.0.0/android-studio-ide-171.4010489-linux.zip

installation

You can co-exist with the stable version you installed before, and unpack the archive folder into a different directory.

Start Studio64.exe (if you are running a 32-bit computer, start Studio.exe)

change your way of updating
By default, each Android Studio installation receives updates through the channel (Canary, beta, or stable) that you used to download initially. If you want to change the update channel for an installation, follow these steps:

    • In Android Studio, choose File > Settings (or, on your Mac, choose Android Studio > Preference).
    • In the left panel, select appearance & Behavior > System Settings > Updates.
    • Make sure that automatically check for updates is selected, and then select a channel from the drop-down list.

You will receive a bubble notification in the IDE when a new version of Android Studio is available in your channel. If you initially chose to ignore the notification, you can also check for updates later by clicking Help > Check for Update (or, on your Mac, clicking Android Studio > Check for Updates).

new Features changes to the IDE
    • Updated 2017.1 versions of the underlying IDE to idea, including parameter hints, semantic highlighting, instant results in search, and more.
    • More new lint Checks
    • Instant run fixes a problem with issue234401, and if the program pauses on a breakpoint, the app restarts, but if the application does not pause on a breakpoint, you should not restart and hot plug should work when you only make the method implementation changes
Kotlin Language Support

Android Studio 3.0 includes support for the Kotlin language, and you can merge Kotlin into your project by converting Java files to Kotlin (单击Code>Convert Java File to Kotlin File) or by using new Project the wizard to create a new project with Kotlin enabled. Click for more information about Kotlin and Android

Support Java8

Android Studio 3.0 introduces built-in support for Java 8 libraries and some Java 8 language features, Jack is no longer required, and you should first prohibit Jack from using the improved Java 8 to support the built-in default tools. Click here for more information. (formerly through Jack to support the JAVA8, now can be abandoned, with support)

The new profiler

Android Studio 3.0 provides a real-time, unified view of the activities of your application. The Android Profiler window replaces the Android Monitor window. To open the profiler for Android, follow these steps:

    • View > Tool windows > Android Profiler (You can also click on the toolbar)
    • Select the devices and applications that you want to configure from the Android Profiler toolbar, and click the Network,cpu or memory schedule to open a more detailed view of each profile.

For more information about each new profiler, see the next article

Logcat has moved to a separate window due to the update of this section

support for instant apps (Instant app)

Android Studio 3.0 allows you to use two new types of modules in your project: Instant application modules and functional modules to create instant apps

Android Studio 3.0 also includes a new refactoring modular operation and app Links Assistant to help you implement instant apps. For more information about Instant apps, see Android Instant Apps

apk Debugger (apk debugger)

The new APK debugger in Android Studio 3.0 lets you configure and debug the APK without having to build them from an Android studio project as long as they are available for debugging. For more information, see Profile and Debug pre-built APKs.

new File Manager

The new Device File Explorer tool window allows you to seamlessly interact with the file system of connected devices.

You can click to view the various files in your phone and copy the files to your computer. This feature replaces the previously managed file system through DDMS. This is great, but it's a lot of trouble to copy files before.

support andriod O Developer Preview

Ndroid Studio 3.0 adds support for Android O, including:

    • A new Adaptive Icon Wizard that allows you to create a new adaptive Launcher icon resource and preview it on different devices. Start the Adaptive Icon Wizard method by right-clicking on your project's res folder, and then click New > Image Asset > Launcher Icons (Adaptive and Legacy). , for more information see adaptive Icons

    • New XML font previews, font selection tools, and support for downloadable fonts, see Working with Fonts

New Template

Android Studio 3.0 includes a new set of templates in the new project and new module wizards, so you can start using Android things to develop IoT devices, see Android things

Layout Editor Improvements

The layout editor in Android Studio 3.0 includes a number of new feature enhancements, including:

    • Updated component tree with improved drag-and-drop view insertion
    • New error panel
    • Support for view barriers and groups
    • Enhanced chain creation (I don't know what that means either)
Layout Retrieval Improvements

The Layout checker in Android Studio 3.0 includes new enhancements that make it easier to debug application layout issues. This includes grouping properties into general categories and View Tree" Properties grouping new search features in the and panels. The Open method is:Tools > Android > Layout Inspector

Google maven Warehouse

Android Support Library maven dependencies can now be used outside of the new Maven repository Android SDK manager, combined with command line Sdkmanager tools and Gradle, This new distribution method simplifies Maven dependency management using a continuous integration system, and to use the new Maven repository, add the URL to the repository library of the Build.gradle file as follows:

repositories {  maven {    "https://maven.google.com"  }}

For more information see: Google Maven and offline repositories

improvements to the APK parser

Android Studio 3.0 has made the following improvements to the APK analysis tool:

    • Display fields other than packages, classes and methods
    • New filtering options for displaying and hiding fields and methods at the top
    • In the tree view, the nodes that are displayed in italics are references that are not defined in the Dex file
    • For apk with Proguard build enabled, you can load the Proguard mapping file that adds functionality to the Dex Viewer, including:
      • Bold indicates that node nodes should not be deleted when shrinking the encoding
      • Enable a button to make the deleted node visible during shrinking
      • Enables a button that displays the original name of a node that is confused by Proguard in the tree view
the new Gradle plugin

Android plugin 3.0.0-ALPHA1 and later versions primarily address the building performance issues of a large number of modules for Android projects. When using new plugins for these items, you should experience the following:

    • Faster configuration time because of deferred dependency resolution.
    • Variant-awareThe dependent solution only applies to the project and variant you are building.
    • Accelerate incremental build time when simple changes are applied to code or resources.
new Android Emulator features

The Android emulator also includes many new features, including the following:

    • The new API level 24 system image and Android O beta system image, including the Google Play Store, facilitates end-to-end testing of your app and helps you keep the Google Play service in sync with your AVDS.
    • Supports OpenGL ES 3.0 system image API level 24 and later on Windows and Linux machines, and significantly improves OpenGL ES 2.0 graphics performance on older emulator system images.

      • Tip: The best effort is currently being made to enable OpenGL ES 3.0 to be automatically enabled on all GPUs from Intel, Nvidia and AMD and may not be enabled automatically if you encounter problems running OpenGL ES 3.x applications. You can ~/.android/advancedFeatures.ini manually enable OpenGL ES 3.0 by modifying it. Modified to:GLESDynamicVersion = true
    • A new and simpler way to generate error reports for your app from the Android emulator.

    • A new link to quickly submit an emulator-related error to the Android team on the Android Issue tracker ( Emulator Tool Bar > Extended Controls > Help > Emulator Help > File a Bug )
    • A new UI to configure the proxy settings used by the Android emulator.Extended Controls > Settings > Proxy.
    • Supports the rotary input of Android Wear devices on the simulator.

For more simulator upgrades, check out Android Emulator Release Notes.

Profiler Detailed (Android Profiler)

The New Android Profiler window in Android Studio 3.0 replaces the Android Monitor tool, which provides real-time data for application CPU, memory, and network activity. You can perform sample-based methods to track code execution, capture heap dumps, view memory allocations, and check network transfer files for more information.

To open the Android Profiler window, follow these steps:

    • Click View > Tool Windows > Android Profiler (You can also click on the toolbar).
    • At the top of the Android Profiler window, select Device ① and the application ② you want to configure.
      If you have connected your device via USB but do not see it, make sure that USB debugging is enabled.
      • If you use an Android emulator or an already rooted device, Android Profiler will list all running processes, even though they may not be debugged. When you start a debugged application, the process is selected by default.

Android Profiler now shows a shared timeline view (), which includes a timeline for real-time graphs of CPU, memory, and network usage. The window also includes the Timeline zoom control ③, jumps to the Live Update button ④ and displays the active state, the user input event, and the event timeline ⑤ of the screen rotation event.

This shared timeline view displays only the timeline graph. To access detailed analysis tools, click the chart that corresponds to the performance data you want to check. For example, to access the tool to check the heap and track memory allocations, click the storage graph.

For more documentation on each of the profiling Tools, see the following:

    • Inspect CPU Activity and Method traces with CPU Profiler
    • Inspect the Java Heap and memory allocations with memory Profiler
    • Inspect network traffic with network Profiler
Turn on Advanced profiler features

By default, not all profiling data is visible. If you see a message saying "Advanced profiling are unavailable for the selected process", you need to enable high-level analysis in the run configuration.

In order to display advanced analytics data, Android studio must inject monitoring logic into the compiled application. Advanced Analytics provides features such as:

    • Event timeline on all parser windows
    • Number of allocated objects in the Memory analyzer
    • Garbage collection events in the Memory analyzer
    • For more information about all transfer files in the network Profiler

To enable advanced Profile analysis, follow these steps:

    • ChooseRun > Edit Configurations
    • Select your application module in the left pane.
    • Click Profiling the tab, and then select Enable advanced profiling. .

Now you can build and run the application again to access the complete set of profiling features. Note, however, that advanced analytics can slow down your build, so you should enable it only if you want to start profiling your application.

APK Debugger

Android Studio 3.0 allows you to configure and debug your apk without having to build them from your Android studio project. However, you need to make sure that you use the debug version of the APK.

To start Debugging apk, click Profile or Debug apk from the Android Studio Welcome screen. Or, if you've already opened an item, tap File > Profile or click Debug APK from the toolbar. In the next dialog window, select the apk you want to import into Android Studio, and then click OK. You should see something similar to what is shown.

Tip: When you import the apk into Android studio, the IDE creates a new project in your home directory and makes a local copy of the target apk.

The Project Android View in the pane allows you to check the following contents of your APK:

    • APK file: Double-click apk to open APK parser.
    • manifests: Extract the App list from the APK.
    • java: Java code that contains the disassembly of Android studio. The Smali file in your apk's Dex file corresponds to a Java class.
    • cpp: If your app contains native code, this directory contains your native library (. so file).
    • External Libraries: Contains Android SDK.

You can start testing your application's performance immediately using Android Profiler, but the profiler is currently only available for app Java processes. Using breakpoints to debug your application's Java and native code, you need to first Attach Java sources and attach native debug symbols .

additional Java sources (Attach Java sources)

By default, Android Studio extracts Java code from your apk and saves it as a. smali file. To debug Java code with breakpoints, you need to attach the Java source to each. smali file that you want to debug.

To attach a Java source, follow these steps:

    • Projectdouble-click the. smali file from the pane (using Android view). When the file is opened, the editor displays a yellow warning banner that asks you to select a Java source, as shown in the figure above.
    • At the top of the editor window, clickAttach Java sources
    • Open the directory of the application's Java source files, and then click open .

Projectwindow, the IDE replaces the. smali file with the appropriate. java file. You can now add breakpoints in the usual way and debug your application.

additional native debug Symbols (Attach native debug symbols)

If your apk file includes the so file does not contain breakpoint debugging, the IDE displays a warning in the "Messages" window, similar to the one shown. Do not attach a debug native library cannot debug apk native code or breakpoints, if you have not done so, make sure to download the NDK and tools.

To attach a native library that can be debugged, follow these steps:

    • Projectunder the CPP Directory of the window, double-click a native library file that does not contain debug symbols, and the editor displays all the Abis tables supported by the APK.
    • In the upper-right corner of the editor window, clickADD
    • Navigate to the directory that contains the debug native library that you want to attach, and then click OK.
    • If the apk and the native library that you can debug are built using different workstations, you need to specify the local path to the debug symbols by following these steps:
      • In the section of the editor window Path Mappings , edit the Local Paths fields in the column, add the local path to the missing debug symbol, as shown in. The IDE automatically maps the path to the path in the local NDK download.
    • Click Apply.

You should now Project see the local source file in the window. You can open these native files to add breakpoints and debug your application as usual.

Device File Manager

Android Studio3.0 includes device File Explorer, which you can view, copy and delete files on your Android device. J is useful when checking for files created by your application or when transferring files to or from a device.

To view files on a hardware device, you must first set up a device for development, such as USB debugging. For more information, see Running applications on hardware devices.

To use your device's file system, follow these steps:

    • Click View > Tool Windows > Device File Explorer, or click the Device File Explorer button in the tool window bar to open the device file Explorer.
    • Select a device from the drop-down list.
    • Right-click a file or directory to create a new file or directory, save the selected file or directory to your machine, upload, delete, or sync. Double-click a file to open it in Android Studio.

Android Studio saves files that you open in this way in a temporary directory outside the project, and if you modify a file that was opened by using Device file Explorer and want to save the changes to your phone, you must manually overwrite the file back to your phone.

The following directory is particularly useful when getting files for a device:

    • data/data/app_name/contains data files for applications stored on internal storage
    • sdcard/contains user files (pictures, etc.) stored on the external user store

      Not all files are visible in the device file browser. For example, an entry in the data/data/ directory that corresponds to an application on a device that is not debugged cannot be expanded in the device file browser.

using Java 8 language features

Android Studio 3.0 Preview 1 and later versions support all Java 7 language features and part of the Java 8 language features, which vary depending on the platform version. This page describes the Java 8 language features that you can use, how to properly configure your project to use them, and any known issues that you may encounter.

Using the Java 8 language feature is optional when developing an Android application. You can leave the project's source and target compatibility values as Java 7, but you still need to compile with JDK 8.

Android Studio now offers built-in support for using some Java 8 language features and third-party libraries that use them. As shown, the default tool implements the new language functionality by performing byte-code conversions, known as the desugar output of the Javac compiler. jackno longer supported, you should first shut down Jack, using the improved Java 8 support for the built-in default tools.

To get started with the supported Java 8 language features, update the Android plugin to 3.0.0-ALPHA1 (or later) and add the following to the module's Build.gradle file:

android {  ...  compileOptions {    sourceCompatibility JavaVersion.VERSION_1_8    targetCompatibility JavaVersion.VERSION_1_8  }}

If Android Studio detects that your project is using JACK,RETROLAMBDA or Dexguard, the IDE uses the Java 8 support provided by these tools. However, consider migrating to the default tools built-in tools

supported Java8 language features and APIs

Android Studio does not support all Java 8 language features, but will add more features to the IDE in the future. Depending on the minsdkversion you are using, some features and APIs are now available, as described in the following table.

Java 8 language features compatible minsdkversion
La MBDA Expressions all versions, but Lambda serialization is supported only if all of the lambda values are serializable.
Method References all versions
Type Annotations All versions. However, type comment information is available at compile time, but is not available at run time. In addition, the platform supports API level 24 and below types, but does not support ElementType . type_use or elementtype.type_parameter .
Default and Static interface methods all versions
repeating Annotations All versions
Java8 Language API compatible with Minsdkversion
Java.lang.annotation.Repeatable API level or higher.
Annotatedelement.getannotationsbytype (Class) API level or higher.
Java.util.stream API level or higher.
Java.lang.FunctionalInterface API level or higher.
Java.lang.reflect.Method.isDefault () API level or higher.
Java.util.function API level or higher.

In addition to the Java language and API 8, Android Studio3 and later versions will support all Android API levels using Try-with-resources

migrating to the default tool

If Android studio discovers that your project is using Jack, Retrolambda, or Dexguard, the IDE will use the Java 8 support provided by these tools. However, these tools have fewer features and support than the default tool chain. Therefore, follow the instructions in this section to migrate to the default tools for Android Studio.

move out from Jack .
The Jack tool has been deprecated, according to this announcement, if your project uses jack, you should migrate to using the JAVA8 default tool built into Android Studio, using the default tools also includes support for third-party libraries using Java 8 language features, Instant Run, and tools that depend on the intermediate. class file.

To disable Jack and switch to the default tool, simply remove the jackoptions block from the module's Build.gradle file:

android {    ...    defaultConfig {        ...        // 移除下面这一块        jackOptions {            enabled true            ...        }    }    // 保持以下配置    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }}

Migrating from Retrolambda
RETROLAMBDA does not support third-party libraries that use Java 8 language features compared to the default toolchain for Android studio. To migrate to the default toolchain, remove the Retrolambda dependency from the project-level Build.gradle file:

‘me.tatarka.retrolambda‘...// 迁移有用的配置后,删除此块。retrolambda {    ...    //如果您有要保留的Java VM的参数    // 将它们移动到项目的gradle.properties文件    ‘-Xmx2048m‘}
disabling support for Java 8 language features

If you experience issues related to new support for Java 8 language features, you can disable it by adding the following to the Gradle.properties file:

android.enableDesugar=false

The next detailed description of the CPU, memory, network of the three detectors

AndroidStudio3.0 Download Use new features Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.