Android Studio 2.0 (aprile 2016)
Nota: se stai sviluppando per l'anteprima per gli sviluppatori N, devi utilizzare Android Studio 2.1 Preview. Android Studio 2.0 non supporta tutte le funzionalità necessarie per il targeting della versione di anteprima N.
Esecuzione istantanea:
- Android Studio ora esegue il deployment di build pulite più velocemente che mai. Inoltre, il push delle modifiche incrementali del codice sull'emulatore o su un dispositivo fisico è ora quasi istantaneo. Rivedi gli aggiornamenti senza eseguire nuovamente il deployment di una nuova build di debug o, in molti casi, senza riavviare l'app.
<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>
Novità di Lint:
- Ispezione delle istruzioni
switch
utilizzando numeri interi annotati@IntDef
per assicurarsi che tutte le costanti vengano gestite. Per aggiungere rapidamente le istruzioni mancanti, utilizza il menu a discesa dell'azione di intent e seleziona Aggiungi costanti @IntDef mancanti. - Segnala i tentativi errati di utilizzare l'interpolazione di stringhe per inserire
i numeri di versione nel file
build.gradle
. - Flag per le classi anonime che estendono la classe
Fragment
. - Flag per il codice nativo in posizioni non sicure, ad esempio le cartelle
res/
easset/
. Questo flag incoraggia l'archiviazione del codice nativo nella cartellalibs/
, che viene poi pacchettizzata in modo sicuro nella cartelladata/app-lib/
dell'applicazione al momento dell'installazione. AOSP: #169950 - Segnalazioni per chiamate non sicure a
Runtime.load()
eSystem.load()
. AOSP: #179980 - Trova e rimuovi le risorse inutilizzate selezionando Refactor > Remove
Unused Resources (Rimodella > Rimuovi
risorse inutilizzate) dalla barra dei menu. Il rilevamento delle risorse inutilizzate ora
supporta le risorse a cui viene fatto riferimento solo da risorse inutilizzate, i riferimenti nei file
non elaborati, come i riferimenti alle immagini
.html
, e gli attributitools:keep
etools:discard
utilizzati dal riduttore di risorse Gradle, tenendo conto dei set di origini inattivi (come le risorse utilizzate in altri flavor di build) e gestendo correttamente le importazioni di campi statici. - Verifica che i riferimenti API impliciti siano supportati su tutte le piattaforme
di destinazione di
minSdkVersion
. - Segnala l'utilizzo improprio di
RecyclerView
eParcelable
. - Ora vengono controllati anche gli avvisi
@IntDef
,@IntRange
e@Size
per arrayint
e varargs.
Ulteriori miglioramenti:
- Ottimizzato per Android Emulator 2.0, che è più veloce che mai, supporta una gamma più ampia di dispositivi virtuali e presenta un'interfaccia utente notevolmente migliorata. Per saperne di più sul nuovo emulatore, leggi le note di rilascio di 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 > General > 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>