Android Studio 2.0 (tháng 4 năm 2016)

Lưu ý: Nếu đang phát triển Bản dùng thử N cho nhà phát triển, thì bạn nên sử dụng Bản dùng thử Android Studio 2.1. Android Studio 2.0 không hỗ trợ mọi tính năng cần thiết để nhắm mục tiêu đến Bản dùng thử N.

Chạy tức thì:

  • Android Studio giờ đây sẽ triển khai các bản dựng sạch nhanh hơn bao giờ hết. Ngoài ra, việc chuyển các thay đổi tăng dần về mã vào trình mô phỏng hoặc thiết bị thực tế giờ đây gần như diễn ra ngay lập tức. Xem lại các bản cập nhật mà không cần triển khai lại bản gỡ lỗi mới hoặc, trong nhiều trường hợp, không cần khởi động lại ứng dụng.
  • <li>Instant Run supports pushing the following changes to a running app:
      <ul>
        <li>Changes to the implementation of an existing instance method or
        static method
        </li>
        <li>Changes to an existing app resource
        </li>
        <li>Changes to structural code, such as a method signature or a static
        field (requires a target device running API level 21 or higher).
        </li>
      </ul>
    </li>
    
    <li>Read the documentation to learn more <a href=
    "/tools/building/building-studio.html#instant-run">about Instant
    Run</a>.
      <p class="note">
        <strong>Note:</strong> Instant Run is supported only when you deploy the
        debug build variant, use <a href=
        "/tools/revisions/gradle-plugin.html#revisions">Android plugin for
        Gradle version 2.0.0</a> or higher, and configure your app's module-level
        <code>build.gradle</code> file for <code>minSdkVersion 15</code> or higher.
        For the best performance, configure your app for <code>minSdkVersion
        21</code> or higher.
      </p>
    </li>
    

Những điểm bổ sung mới cho công cụ tìm lỗi mã nguồn:

  • Kiểm tra các câu lệnh switch bằng số nguyên có chú giải @IntDef để đảm bảo mọi hằng số đều được xử lý. Để thêm nhanh mọi câu lệnh bị thiếu, hãy sử dụng trình đơn thả xuống thao tác theo ý định và chọn Add Missing @IntDef Constants (Thêm hằng số @IntDef bị thiếu).
  • Gắn cờ cho những lần thử dùng loại nội suy chuỗi không chính xác để chèn số phiên bản trong tệp build.gradle.
  • Gắn cờ cho các lớp ẩn danh mở rộng lớp Fragment.
  • Gắn cờ cho mã gốc ở các vị trí không an toàn, chẳng hạn như thư mục res/asset/. Cờ này khuyến khích việc lưu trữ mã gốc trong thư mục libs/, sau đó, mã này sẽ được đóng gói một cách an toàn vào thư mục data/app-lib/ của ứng dụng khi cài đặt. AOSP: 169950
  • Gắn cờ cho các lệnh gọi không an toàn đến Runtime.load() và lệnh gọi đến System.load(). AOSP: 179980
  • Tìm và xoá mọi tài nguyên không dùng đến bằng cách chọn Refactor > Remove Unused Resources (Tái cấu trúc > Xoá Tài nguyên không dùng đến) khỏi thanh trình đơn. Tính năng phát hiện tài nguyên không dùng đến giờ đây sẽ chỉ hỗ trợ các tài nguyên được tham chiếu bởi tài nguyên không dùng đến, tài nguyên trong tệp thô, chẳng hạn như tệp tham chiếu hình ảnh .html và thuộc tính tools:keeptools:discard do trình rút gọn tài nguyên Gradle sử dụng, trong khi vẫn tính đến các nhóm tài nguyên không hoạt động (chẳng hạn như tài nguyên được dùng trong các phiên bản bản dựng khác) và xử lý đúng cách việc nhập trường tĩnh.
  • Hãy kiểm tra để đảm bảo rằng các tài liệu tham khảo API ngầm ẩn được hỗ trợ trên mọi nền tảng mà minSdkVersion nhắm đến.
  • Gắn cờ việc sử dụng RecyclerViewParcelable sai cách.
  • Tính năng kiểm tra @IntDef, @IntRange@Size giờ đây cũng sẽ được kiểm tra cho mảng và vararg của int.

Những điểm cải tiến bổ sung:

  • Tối ưu hoá cho Trình mô phỏng Android 2.0, phiên bản nhanh hơn bao giờ hết, hỗ trợ nhiều thiết bị ảo hơn và có giao diện người dùng được cải thiện đáng kể. Để tìm hiểu thêm về trình mô phỏng mới này, hãy đọc ghi chú phát hành của Bộ công cụ SDK.
  • <li>Improvements to the <a href=
    "/tools/devices/managing-avds.html">Android Virtual Device
    Manager</a>:
      <ul>
        <li>System images are now categorized under the following tabs:
        <em>Recommended</em>, <em>x86</em>, and <em>Other</em>.
        </li>
        <li>Under advanced settings, you can enable multi-core support and
        specify the number of cores the emulator can use.
        </li>
        <li>Under advanced settings, you can determine how graphics are rendered
        on the emulator by selecting one of the following options:
          <ul>
            <li>
              <strong>Hardware:</strong> use you computer's graphics card for
              faster rendering.
            </li>
            <li>
              <strong>Software:</strong> use software-based rendering.
            </li>
            <li>
              <strong>Auto:</strong> let the emulator decide the best option. This
              is the default setting.
            </li>
          </ul>
        </li>
      </ul>
    </li>
    
    <li>Improved AAPT packaging times by specifying deploy target before the app
    is built. This allows Android Studio to efficiently package only the
    resources required by the specified device.
    </li>
    
    <li>Added Cloud Test Lab integration to provide on-demand app testing with
    the convenience and scalability of a cloud service. Learn more about how you
    can <a href="/training/testing/start/index.html#run-ctl">use Cloud
    Test Lab with Android Studio</a>.
    </li>
    
    <li>Added a preview of the new <a class="external-link" href=
    "//tools.android.com/tech-docs/gpu-profiler">GPU Debugger</a>. For graphics
    intensive applications, you can now visually step through your OpenGL ES code
    to optimize your app or game.
    </li>
    
    <li>Added Google App Indexing Test. Add support for URLs, app
    indexing, and search functionality to your apps to help drive more
    traffic to your app, discover which app content is used most, and attract
    new users. Test and validate URLs in your app all within Android
    Studio. See <a href=
    "/tools/help/app-link-indexing.html">Supporting URLs and App
      Indexing in Android Studio</a>.
    </li>
    
    <li>Upgrades from the latest IntelliJ 15 release, including improved code
    analysis and performance. See <a class="external-link" href=
    "https://www.jetbrains.com/idea/whatsnew">What's New in IntelliJ</a> for a
    complete description of the new features and enhancements.
    </li>
    
    <li>XML editor auto-complete now adds quotations marks when completing
    attributes. To check if this option is enabled, open the <b>Setting</b> or
    <b>Preferences</b> dialogue, navigate to <b>Editor &gt; General &gt; Smart
    Keys</b>, and check the box next to <b>Add quotes for attribute value on
    attribute completion</b>. <a class="external-link" href=
    "//b.android.com/195113">Issue: 195113</a>
    </li>
    
    <li>The XML editor now supports code completion for <a href=
    "/topic/libraries/data-binding/index.html#layout_details">data binding</a>
    expressions.
    </li>