Android Studio 2.0 (April 2016)

Hinweis:Wenn Sie für die Entwicklervorschau N entwickeln, sollten Sie die Vorabversion von Android Studio 2.1 verwenden. Android Studio 2.0 unterstützt nicht alle Funktionen, die für das Targeting auf N Preview erforderlich sind.

Instant Run:

  • Mit Android Studio werden saubere Builds jetzt schneller als je zuvor bereitgestellt. Außerdem erfolgt das Übertragen inkrementeller Codeänderungen an den Emulator oder ein physisches Gerät fast augenblicklich. Überprüfen Sie Ihre Updates, ohne einen neuen Debug-Build bereitzustellen oder in vielen Fällen, ohne die App neu zu starten.
  • <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>
    

Neu bei Lint:

  • Prüfung von switch-Anweisungen mit @IntDef-annotierten Ganzzahlen, um sicherzustellen, dass alle Konstanten verarbeitet werden. Um fehlende Anweisungen schnell hinzuzufügen, wählen Sie im Drop-down-Menü für Absichtsaktionen die Option Fehlende @IntDef-Konstanten hinzufügen aus.
  • Flags für falsche Versuche, Versionsnummern mithilfe der Stringinterpolation in die Datei build.gradle einzufügen.
  • Flags für anonyme Klassen, die die Klasse Fragment erweitern.
  • Flags für nativen Code an unsicheren Orten, z. B. in den Ordnern res/ und asset/. Dieses Flag empfiehlt, nativer Code im Ordner libs/ zu speichern, der dann bei der Installation sicher im Ordner data/app-lib/ der Anwendung verpackt wird. AOSP: Nr. 169950
  • Flags für unsichere Aufrufe von Runtime.load()- und System.load()-Aufrufen. AOSP: Nr. 179980
  • Suchen und entfernen Sie nicht verwendete Ressourcen. Wählen Sie dazu in der Menüleiste Refaktorieren > Nicht verwendete Ressourcen entfernen aus. Die Erkennung nicht verwendeter Ressourcen unterstützt jetzt nur Ressourcen, auf die nicht von nicht verwendeten Ressourcen verwiesen wird, Referenzen in Rohdateien wie .html-Bildreferenzen und tools:keep- und tools:discard-Attribute, die vom Gradle-Ressourcen-Shrinker verwendet werden. Dabei werden inaktive Quellsätze (z. B. in anderen Build-Varianten verwendete Ressourcen) und die ordnungsgemäße Verarbeitung statischer Feldimporte berücksichtigt.
  • Prüft, ob implizite API-Referenzen auf allen Plattformen unterstützt werden, auf die minSdkVersion ausgerichtet ist.
  • Meldet eine unzulässige Verwendung von RecyclerView und Parcelable.
  • @IntDef-, @IntRange- und @Size-Prüfungen werden jetzt auch auf int-Arrays und -Varargs geprüft.

Weitere Verbesserungen:

  • Optimiert für Android Emulator 2.0. Es ist schneller als je zuvor, unterstützt eine größere Anzahl virtueller Geräte und bietet eine drastisch verbesserte Benutzeroberfläche. Weitere Informationen zum neuen Emulator finden Sie in den Versionshinweisen zu SDK-Tools.
  • <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>