Docs: Migrating platform docs to /guide/platform/ with new landing page
Bug:29575457 Change-Id: I6d576e9dd28132fcf7e6e017187f30702066c2af
This commit is contained in:
@@ -260,27 +260,6 @@ toc:
|
|||||||
value: ICU4J Android 框架 API
|
value: ICU4J Android 框架 API
|
||||||
- name: zh-tw-lang
|
- name: zh-tw-lang
|
||||||
value: ICU4J Android 架構 API
|
value: ICU4J Android 架構 API
|
||||||
- title: Funciones del lenguaje Java 8
|
|
||||||
path: /preview/j8-jack.html
|
|
||||||
path_attributes:
|
|
||||||
- name: es-lang
|
|
||||||
value: Funciones del lenguaje Java 8
|
|
||||||
- name: in-lang
|
|
||||||
value: Fitur Bahasa Java 8
|
|
||||||
- name: ja-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- name: ko-lang
|
|
||||||
value: Java 8 언어 기능
|
|
||||||
- name: pt-br-lang
|
|
||||||
value: Recursos de linguagem do Java 8
|
|
||||||
- name: ru-lang
|
|
||||||
value: Возможности языка Java 8
|
|
||||||
- name: vi-lang
|
|
||||||
value: Tính năng của Ngôn ngữ Java 8
|
|
||||||
- name: zh-cn-lang
|
|
||||||
value: Java 8 语言功能
|
|
||||||
- name: zh-tw-lang
|
|
||||||
value: Java 8 語言功能
|
|
||||||
- title: Actualizaciones para Android for Work
|
- title: Actualizaciones para Android for Work
|
||||||
path: /preview/features/afw.html
|
path: /preview/features/afw.html
|
||||||
- title: Acceso a directorios determinados
|
- title: Acceso a directorios determinados
|
||||||
|
|||||||
@@ -260,27 +260,6 @@ toc:
|
|||||||
value: ICU4J Android 框架 API
|
value: ICU4J Android 框架 API
|
||||||
- name: zh-tw-lang
|
- name: zh-tw-lang
|
||||||
value: ICU4J Android 架構 API
|
value: ICU4J Android 架構 API
|
||||||
- title: Fitur Bahasa Java 8
|
|
||||||
path: /preview/j8-jack.html
|
|
||||||
path_attributes:
|
|
||||||
- name: es-lang
|
|
||||||
value: Funciones del lenguaje Java 8
|
|
||||||
- name: in-lang
|
|
||||||
value: Fitur Bahasa Java 8
|
|
||||||
- name: ja-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- name: ko-lang
|
|
||||||
value: Java 8 언어 기능
|
|
||||||
- name: pt-br-lang
|
|
||||||
value: Recursos de linguagem do Java 8
|
|
||||||
- name: ru-lang
|
|
||||||
value: Возможности языка Java 8
|
|
||||||
- name: vi-lang
|
|
||||||
value: Tính năng của Ngôn ngữ Java 8
|
|
||||||
- name: zh-cn-lang
|
|
||||||
value: Java 8 语言功能
|
|
||||||
- name: zh-tw-lang
|
|
||||||
value: Java 8 語言功能
|
|
||||||
- title: Pembaruan Android for Work
|
- title: Pembaruan Android for Work
|
||||||
path: /preview/features/afw.html
|
path: /preview/features/afw.html
|
||||||
- title: Scoped Directory Access
|
- title: Scoped Directory Access
|
||||||
|
|||||||
@@ -260,27 +260,6 @@ toc:
|
|||||||
value: ICU4J Android 框架 API
|
value: ICU4J Android 框架 API
|
||||||
- name: zh-tw-lang
|
- name: zh-tw-lang
|
||||||
value: ICU4J Android 架構 API
|
value: ICU4J Android 架構 API
|
||||||
- title: Java 8 の言語機能
|
|
||||||
path: /preview/j8-jack.html
|
|
||||||
path_attributes:
|
|
||||||
- name: es-lang
|
|
||||||
value: Funciones del lenguaje Java 8
|
|
||||||
- name: in-lang
|
|
||||||
value: Fitur Bahasa Java 8
|
|
||||||
- name: ja-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- name: ko-lang
|
|
||||||
value: Java 8 언어 기능
|
|
||||||
- name: pt-br-lang
|
|
||||||
value: Recursos de linguagem do Java 8
|
|
||||||
- name: ru-lang
|
|
||||||
value: Возможности языка Java 8
|
|
||||||
- name: vi-lang
|
|
||||||
value: Tính năng của Ngôn ngữ Java 8
|
|
||||||
- name: zh-cn-lang
|
|
||||||
value: Java 8 语言功能
|
|
||||||
- name: zh-tw-lang
|
|
||||||
value: Java 8 語言功能
|
|
||||||
- title: Android for Work のアップデート
|
- title: Android for Work のアップデート
|
||||||
path: /preview/features/afw.html
|
path: /preview/features/afw.html
|
||||||
- title: 特定のディレクトリへのアクセス
|
- title: 特定のディレクトリへのアクセス
|
||||||
|
|||||||
@@ -260,27 +260,6 @@ toc:
|
|||||||
value: ICU4J Android 框架 API
|
value: ICU4J Android 框架 API
|
||||||
- name: zh-tw-lang
|
- name: zh-tw-lang
|
||||||
value: ICU4J Android 架構 API
|
value: ICU4J Android 架構 API
|
||||||
- title: Java 8 언어 기능
|
|
||||||
path: /preview/j8-jack.html
|
|
||||||
path_attributes:
|
|
||||||
- name: es-lang
|
|
||||||
value: Funciones del lenguaje Java 8
|
|
||||||
- name: in-lang
|
|
||||||
value: Fitur Bahasa Java 8
|
|
||||||
- name: ja-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- name: ko-lang
|
|
||||||
value: Java 8 언어 기능
|
|
||||||
- name: pt-br-lang
|
|
||||||
value: Recursos de linguagem do Java 8
|
|
||||||
- name: ru-lang
|
|
||||||
value: Возможности языка Java 8
|
|
||||||
- name: vi-lang
|
|
||||||
value: Tính năng của Ngôn ngữ Java 8
|
|
||||||
- name: zh-cn-lang
|
|
||||||
value: Java 8 语言功能
|
|
||||||
- name: zh-tw-lang
|
|
||||||
value: Java 8 語言功能
|
|
||||||
- title: Android for Work 업데이트
|
- title: Android for Work 업데이트
|
||||||
path: /preview/features/afw.html
|
path: /preview/features/afw.html
|
||||||
- title: 범위가 지정된 디렉터리 액세스
|
- title: 범위가 지정된 디렉터리 액세스
|
||||||
|
|||||||
@@ -260,27 +260,6 @@ toc:
|
|||||||
value: ICU4J Android 框架 API
|
value: ICU4J Android 框架 API
|
||||||
- name: zh-tw-lang
|
- name: zh-tw-lang
|
||||||
value: ICU4J Android 架構 API
|
value: ICU4J Android 架構 API
|
||||||
- title: Recursos de linguagem do Java 8
|
|
||||||
path: /preview/j8-jack.html
|
|
||||||
path_attributes:
|
|
||||||
- name: es-lang
|
|
||||||
value: Funciones del lenguaje Java 8
|
|
||||||
- name: in-lang
|
|
||||||
value: Fitur Bahasa Java 8
|
|
||||||
- name: ja-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- name: ko-lang
|
|
||||||
value: Java 8 언어 기능
|
|
||||||
- name: pt-br-lang
|
|
||||||
value: Recursos de linguagem do Java 8
|
|
||||||
- name: ru-lang
|
|
||||||
value: Возможности языка Java 8
|
|
||||||
- name: vi-lang
|
|
||||||
value: Tính năng của Ngôn ngữ Java 8
|
|
||||||
- name: zh-cn-lang
|
|
||||||
value: Java 8 语言功能
|
|
||||||
- name: zh-tw-lang
|
|
||||||
value: Java 8 語言功能
|
|
||||||
- title: Atualizações no Android for Work
|
- title: Atualizações no Android for Work
|
||||||
path: /preview/features/afw.html
|
path: /preview/features/afw.html
|
||||||
- title: Acesso a diretórios com escopo
|
- title: Acesso a diretórios com escopo
|
||||||
|
|||||||
@@ -260,27 +260,6 @@ toc:
|
|||||||
value: ICU4J Android フレームワーク API
|
value: ICU4J Android フレームワーク API
|
||||||
- name: zh-tw-lang
|
- name: zh-tw-lang
|
||||||
value: ICU4J Android フレームワーク API
|
value: ICU4J Android フレームワーク API
|
||||||
- title: Java 8 语言功能
|
|
||||||
path: /preview/j8-jack.html
|
|
||||||
path_attributes:
|
|
||||||
- name: es-lang
|
|
||||||
value: Funciones del lenguaje Java 8
|
|
||||||
- name: in-lang
|
|
||||||
value: Fitur Bahasa Java 8
|
|
||||||
- name: ja-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- name: ko-lang
|
|
||||||
value: Java 8 언어 기능
|
|
||||||
- name: pt-br-lang
|
|
||||||
value: Recursos de linguagem do Java 8
|
|
||||||
- name: ru-lang
|
|
||||||
value: Возможности языка Java 8
|
|
||||||
- name: vi-lang
|
|
||||||
value: Tính năng của Ngôn ngữ Java 8
|
|
||||||
- name: zh-cn-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- name: zh-tw-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- title: Android for Work Updates
|
- title: Android for Work Updates
|
||||||
path: /preview/features/afw.html
|
path: /preview/features/afw.html
|
||||||
- title: 作用域目录访问
|
- title: 作用域目录访问
|
||||||
|
|||||||
@@ -1220,4 +1220,5 @@ redirects:
|
|||||||
to: /guide/topics/ui/notifiers/notifications.html
|
to: /guide/topics/ui/notifiers/notifications.html
|
||||||
- from: /preview/features/multilingual-support.html
|
- from: /preview/features/multilingual-support.html
|
||||||
to: /guide/topics/resources/multilingual-support.html
|
to: /guide/topics/resources/multilingual-support.html
|
||||||
|
- from: /preview/j8-jack.html
|
||||||
|
to: /guide/platform/j8-jack.html
|
||||||
@@ -9,6 +9,33 @@ toc:
|
|||||||
- title: System Permissions
|
- title: System Permissions
|
||||||
path: /guide/topics/security/permissions.html
|
path: /guide/topics/security/permissions.html
|
||||||
|
|
||||||
|
- title: Platform Architecture
|
||||||
|
path: /guide/platform/index.html
|
||||||
|
section:
|
||||||
|
- title: Use Java 8 Language Features
|
||||||
|
path: /guide/platform/j8-jack.html
|
||||||
|
path_attributes:
|
||||||
|
- name: es-lang
|
||||||
|
value: Funciones del lenguaje Java 8
|
||||||
|
- name: in-lang
|
||||||
|
value: Fitur Bahasa Java 8
|
||||||
|
- name: ja-lang
|
||||||
|
value: Java 8 の機能
|
||||||
|
- name: ko-lang
|
||||||
|
value: Java 8 언어 기능
|
||||||
|
- name: pt-br-lang
|
||||||
|
value: Recursos de linguagem do Java 8
|
||||||
|
- name: ru-lang
|
||||||
|
value: Возможности языка Java 8
|
||||||
|
- name: vi-lang
|
||||||
|
value: Tính năng của Ngôn ngữ Java 8
|
||||||
|
- name: zh-cn-lang
|
||||||
|
value: Java 8 语言功能
|
||||||
|
- name: zh-tw-lang
|
||||||
|
value: Java 8 語言功能
|
||||||
|
- title: Verifying App Behavior on the Android Runtime (ART)
|
||||||
|
path: /guide/practices/verifying-apps-art.html
|
||||||
|
|
||||||
- title: App Components
|
- title: App Components
|
||||||
path: /guide/components/index.html
|
path: /guide/components/index.html
|
||||||
section:
|
section:
|
||||||
@@ -422,5 +449,3 @@ toc:
|
|||||||
path: /guide/practices/screen-compat-mode.html
|
path: /guide/practices/screen-compat-mode.html
|
||||||
- title: Supporting Tablets and Handsets
|
- title: Supporting Tablets and Handsets
|
||||||
path: /guide/practices/tablets-and-handsets.html
|
path: /guide/practices/tablets-and-handsets.html
|
||||||
- title: Verifying App Behavior on ART
|
|
||||||
path: /guide/practices/verifying-apps-art.html
|
|
||||||
|
|||||||
BIN
docs/html/guide/platform/Images/android-stack_2x.png
Normal file
BIN
docs/html/guide/platform/Images/android-stack_2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
217
docs/html/guide/platform/index.jd
Normal file
217
docs/html/guide/platform/index.jd
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
page.title=Platform Architecture
|
||||||
|
page.keywords=platform,architecture,framework
|
||||||
|
@jd:body
|
||||||
|
|
||||||
|
|
||||||
|
<div id="qv-wrapper">
|
||||||
|
<div id="qv">
|
||||||
|
<h2>
|
||||||
|
In this document
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<a href="#linux-kernel">The Linux Kernel</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#hal">Hardware Abstraction Layer (HAL)</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#art">Android Runtime</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#native-libs">Native C/C++ Libraries</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#api-framework">Java API Framework</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#system-apps">System Apps</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Android is an open source, Linux-based software stack created for a wide
|
||||||
|
array of devices and form factors. The following diagram shows the major
|
||||||
|
components of the Android platform.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<img src="/guide/platform/images/android-stack_2x.png" alt="" width=
|
||||||
|
"519">
|
||||||
|
<p class="img-caption">
|
||||||
|
<strong>Figure 1.</strong> The Android software stack.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 id="linux-kernel">
|
||||||
|
The Linux Kernel
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The foundation of the Android platform is the Linux kernel. For example,
|
||||||
|
<a href="#art">the Android Runtime (ART)</a> relies on the Linux kernel for
|
||||||
|
underlying functionalities such as threading and low-level memory management.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Using a Linux kernel allows Android to take advantage of <a href=
|
||||||
|
"https://source.android.com/security/overview/kernel-security.html">key
|
||||||
|
security features</a> and allows device manufacturers to develop hardware
|
||||||
|
drivers for a well-known kernel.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 id="hal">
|
||||||
|
Hardware Abstraction Layer (HAL)
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The <a href=
|
||||||
|
"https://source.android.com/devices/index.html#Hardware%20Abstraction%20Layer">
|
||||||
|
hardware abstraction layer (HAL)</a> provides standard interfaces that expose
|
||||||
|
device hardware capabilities to the higher-level <a href=
|
||||||
|
"#api-framework">Java API framework</a>. The HAL consists of multiple library
|
||||||
|
modules, each of which implements an interface for a specific type of hardware
|
||||||
|
component, such as the <a href=
|
||||||
|
"https://source.android.com/devices/camera/index.html">camera</a> or <a href=
|
||||||
|
"https://source.android.com/devices/bluetooth.html">bluetooth</a> module.
|
||||||
|
When a framework API makes a call to access device hardware, the Android
|
||||||
|
system loads the library module for that hardware component.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 id="art">
|
||||||
|
Android Runtime
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
For devices running Android version 5.0 (API level 21) or higher, each app
|
||||||
|
runs in its own process and with its own instance of the <a href=
|
||||||
|
"http://source.android.com/devices/tech/dalvik/index.html">Android Runtime
|
||||||
|
(ART)</a>. ART is written to run multiple virtual machines on low-memory
|
||||||
|
devices by executing DEX files, a bytecode format designed specially for
|
||||||
|
Android that's optimized for minimal memory footprint. Build toolchains, such
|
||||||
|
as <a href="https://source.android.com/source/jack.html">Jack</a>, compile
|
||||||
|
Java sources into DEX bytecode, which can run on the Android platform.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Some of the major features of ART include the following:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Ahead-of-time (AOT) and just-in-time (JIT) compilation
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>Optimized garbage collection (GC)
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>Better debugging support, including a dedicated sampling profiler,
|
||||||
|
detailed diagnostic exceptions and crash reporting, and the ability to set
|
||||||
|
watchpoints to monitor specific fields
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Prior to Android version 5.0 (API level 21), Dalvik was the Android runtime.
|
||||||
|
If your app runs well on ART, then it should work on Dalvik as well, but
|
||||||
|
<a href="/guide/platform/verifying-apps-art.html">the reverse may not be
|
||||||
|
true</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Android also includes a set of core runtime libraries that provide most of
|
||||||
|
the functionality of the Java programming language, including some <a href=
|
||||||
|
"/guide/platform/j8-jack.html">Java 8 language features</a>, that the Java
|
||||||
|
API framework uses.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 id="native-libs">
|
||||||
|
Native C/C++ Libraries
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Many core Android system components and services, such as ART and HAL, are
|
||||||
|
built from native code that require native libraries written in C and C++.
|
||||||
|
The Android platform provides Java framework APIs to expose the functionality
|
||||||
|
of some of these native libraries to apps. For example, you can access
|
||||||
|
<a href="/guide/topics/graphics/opengl.html">OpenGL ES</a> through the
|
||||||
|
Android framework’s <a href=
|
||||||
|
"/reference/android/opengl/package-summary.html">Java OpenGL API</a> to add
|
||||||
|
support for drawing and manipulating 2D and 3D graphics in your app.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you are developing an app that requires C or C++ code, you can use the
|
||||||
|
<a href="/ndk/index.html">Android NDK</a> to access some of these <a href=
|
||||||
|
"/ndk/guides/stable_apis.html">native platform libraries</a> directly from
|
||||||
|
your native code.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 id="api-framework">
|
||||||
|
Java API Framework
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The entire feature-set of the Android OS is available to you through APIs
|
||||||
|
written in the Java language. These APIs form the building blocks you need to
|
||||||
|
create Android apps by simplifying the reuse of core, modular system
|
||||||
|
components and services, which include the following:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>A rich and extensible <a href="/guide/topics/ui/overview.html">View
|
||||||
|
System</a> you can use to build an app’s UI, including lists, grids, text
|
||||||
|
boxes, buttons, and even an embeddable web browser
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>A <a href="/guide/topics/resources/overview.html">Resource Manager</a>,
|
||||||
|
providing access to non-code resources such as localized strings, graphics,
|
||||||
|
and layout files
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>A <a href="/guide/topics/ui/notifiers/notifications.html">Notification
|
||||||
|
Manager</a> that enables all apps to display custom alerts in the status bar
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>An <a href="/guide/components/activities.html">Activity Manager</a> that
|
||||||
|
manages the lifecycle of apps and provides a common <a href=
|
||||||
|
"/guide/components/tasks-and-back-stack.html">navigation back stack</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="/guide/topics/providers/content-providers.html">Content
|
||||||
|
Providers</a> that enable apps to access data from other apps, such as
|
||||||
|
the Contacts app, or to share their own data
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Developers have full access to the same <a href=
|
||||||
|
"/reference/packages.html">framework APIs</a> that Android system apps use.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 id="system-apps">
|
||||||
|
System Apps
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Android comes with a set of core apps for email, SMS messaging, calendars,
|
||||||
|
internet browsing, contacts, and more. Apps included with the platform have
|
||||||
|
no special status among the apps the user chooses to install. So a
|
||||||
|
third-party app can become the user's default web browser, SMS messenger, or
|
||||||
|
even the default keyboard (some exceptions apply, such as the system's
|
||||||
|
Settings app).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The system apps function both as apps for users and to provide key
|
||||||
|
capabilities that developers can access from their own app. For example, if
|
||||||
|
your app would like to deliver an SMS message, you don't need to build that
|
||||||
|
functionality yourself—you can instead invoke whichever SMS app is already
|
||||||
|
installed to deliver a message to the recipient you specify.
|
||||||
|
</p>
|
||||||
@@ -1,41 +1,63 @@
|
|||||||
page.title=Java 8 Language Features
|
page.title=Use Java 8 Language Features
|
||||||
page.keywords="android N", "Java 8", "Jack"
|
page.keywords="android N", "Java 8", "Jack"
|
||||||
@jd:body
|
@jd:body
|
||||||
|
|
||||||
<div id="qv-wrapper">
|
<div id="qv-wrapper">
|
||||||
<div id="qv">
|
<div id="qv">
|
||||||
|
<h2 id="Contents">
|
||||||
|
In this document:
|
||||||
|
</h2>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<a href="#supported-features">Supported Java 8 Language Features and APIs</a>
|
<a href="#supported-features">Supported Java 8 Language Features and
|
||||||
|
APIs</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#configuration">Enabling Java 8 Features and the Jack Toolchain</a>
|
<a href="#configuration">Enable Java 8 Features and the Jack
|
||||||
|
Toolchain</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="#configure-gradle">Configure Gradle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#known-issues">Known issues</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Android N introduces support for Java 8 language features
|
<p>
|
||||||
that you can use when developing apps that target Android N.
|
Android supports all Java 7 language features and a subset of Java 8 language
|
||||||
This page describes the new language features supported in the Android N
|
features that vary by platform version. This page describes the new language
|
||||||
Preview, how to properly set up your project to use them, and any known
|
features you can use, how to properly configure your project to use them, and
|
||||||
issues you may encounter.
|
any known issues you may encounter.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>To start using these features, you need to download and set up Android
|
|
||||||
Studio 2.1 and the Android N Preview SDK, which includes the required
|
|
||||||
Jack toolchain and updated Android Plugin for Gradle. If you haven't yet
|
|
||||||
installed the Android N Preview SDK, see <a href=
|
|
||||||
"{@docRoot}preview/setup-sdk.html">Set Up to Develop for Android N</a>.</p>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p class="note">
|
<p class="note">
|
||||||
<strong>Note:</strong> Using the new Java 8 language features is not a
|
<strong>Note:</strong> When developing apps for Android, using Java 8
|
||||||
requirement for developing apps that target the Android N platform. If you
|
language features is optional. You can keep your project's source and target
|
||||||
don't want to write code with Java 8 language features, you can keep your
|
compatibility values set to Java 7, but you still need to compile using JDK
|
||||||
project's source and target compatibility values set to Java 7, but you still
|
8.
|
||||||
must compile with JDK 8 to build against the Android N platform.
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Support for Java 8 language features requires a new compiler called <a href=
|
||||||
|
"https://source.android.com/source/jack.html">Jack</a>. Jack is supported
|
||||||
|
only on Android Studio 2.1 and higher. So if you want to use Java 8 language
|
||||||
|
features, you need to use Android Studio 2.1 to build your app.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you already have Android Studio installed, make sure you update to the
|
||||||
|
latest version by clicking <strong>Help > Check for Update</strong> (on
|
||||||
|
Mac, <strong>Android Studio > Check for Updates</strong>). If you don't
|
||||||
|
already have the IDE installed on your workstation, <a href=
|
||||||
|
"{@docRoot}studio/">download Android Studio here</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 id="supported-features">
|
<h2 id="supported-features">
|
||||||
@@ -43,9 +65,9 @@ installed the Android N Preview SDK, see <a href=
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Android does not currently support all Java 8 language features. However, the
|
Android does not support all Java 8 language features. However, the
|
||||||
following features are now available when developing apps targeting the
|
following features are available when developing apps targeting
|
||||||
Android N Preview:
|
Android 7.0 (API level 24):
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
@@ -94,7 +116,7 @@ installed the Android N Preview SDK, see <a href=
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Additionally, the following Java 8 language feature APIs are now available:
|
Additionally, the following Java 8 language APIs are also available:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
@@ -144,37 +166,36 @@ installed the Android N Preview SDK, see <a href=
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2 id="configuration">
|
<h2 id="configuration">
|
||||||
Enabling Java 8 Features and the Jack Toolchain
|
Enable Java 8 Features and the Jack Toolchain
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
In order to use the new Java 8 language features, you need to also use the
|
In order to use the new Java 8 language features, you need to also use the
|
||||||
new <a class="external-link" href=
|
<a href="https://source.android.com/source/jack.html">Jack toolchain</a>.
|
||||||
"https://source.android.com/source/jack.html">Jack toolchain</a>. This new
|
This new Android toolchain compiles Java language sources into
|
||||||
Android toolchain compiles Java language source into Android-readable dex
|
Android-readable DEX bytecode, has its own {@code .jack} library format, and
|
||||||
bytecode, has its own {@code .jack} library format, and provides most toolchain
|
provides most toolchain features as part of a single tool: repackaging,
|
||||||
features as part of a single tool: repackaging, shrinking, obfuscation and
|
shrinking, obfuscation and multidex.
|
||||||
multidex.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>Here is a comparison of the two toolchains used to build Android DEX files:</p>
|
<p>Here is a comparison of the two toolchains used to build Android DEX files:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Legacy javac toolchain:<br>
|
<li>Legacy javac toolchain:<br>
|
||||||
<b>javac</b> ({@code .java} --> {@code .class}) --> <b>dx</b> ({@code
|
<b>javac</b> ({@code .java} → {@code .class}) → <b>dx</b> ({@code
|
||||||
.class} --> {@code .dex})
|
.class} → {@code .dex})
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>New Jack toolchain:<br>
|
<li>New Jack toolchain:<br>
|
||||||
<b>Jack</b> ({@code .java} --> {@code .jack} --> {@code .dex})
|
<b>Jack</b> ({@code .java} → {@code .jack} → {@code .dex})
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>
|
<h3 id="configure-gradle">
|
||||||
Configuring Gradle
|
Configure Gradle
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To enable the Java 8 language features and Jack for your project, enter the
|
To enable Java 8 language features and Jack for your project, enter the
|
||||||
following in your module-level {@code build.gradle} file:
|
following in your module-level {@code build.gradle} file:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -195,7 +216,7 @@ android {
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 id="known-issues">
|
<h3 id="known-issues">
|
||||||
Known Issues
|
Known issues
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -217,5 +238,5 @@ examples of these tools are:</p>
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>If you find other problems while using Jack, <a href=
|
<p>If you find other issues while using Jack, <a href=
|
||||||
"http://tools.android.com/filing-bugs">please file a bug</a>.</p>
|
"http://tools.android.com/filing-bugs">please file a bug</a>.</p>
|
||||||
@@ -2,60 +2,82 @@ page.title=Verifying App Behavior on the Android Runtime (ART)
|
|||||||
@jd:body
|
@jd:body
|
||||||
|
|
||||||
<div id="qv-wrapper">
|
<div id="qv-wrapper">
|
||||||
<div id="qv">
|
<div id="qv">
|
||||||
<h2>Quickview</h2>
|
<h2 id="Contents">
|
||||||
<ul>
|
In this document
|
||||||
<li>The new Android runtime (ART) is available on some of the newest Android
|
</h2>
|
||||||
devices, though all of them currently have Dalvik as the default
|
|
||||||
runtime.</li>
|
|
||||||
<li>App developers should make sure their apps are compatible with ART,
|
|
||||||
especially if you use JNI to run native code or if you use certain tools
|
|
||||||
that produce non-standard code (such as some obfuscators).</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 id="Contents">In this document</h2>
|
<ol>
|
||||||
<ol>
|
<li>
|
||||||
<li><a href="#GC_Migration">Addressing Garbage Collection (GC) Issues</a></li>
|
<a href="#GC_Migration">Addressing Garbage Collection (GC) Issues</a>
|
||||||
<li><a href="#JNI_Issues">Preventing JNI Issues</a>
|
</li>
|
||||||
<ol>
|
|
||||||
<li><a href="#JNI_and_GC">Checking JNI code for garbage-collection
|
<li>
|
||||||
issues</a></li>
|
<a href="#JNI_Issues">Preventing JNI Issues</a>
|
||||||
<li><a href="#Error_Handling">Error handling</a></li>
|
<ol>
|
||||||
<li><a href="#Object_Model_Changes">Object model changes</a></li>
|
<li>
|
||||||
</ol>
|
<a href="#JNI_and_GC">Checking JNI code for garbage-collection
|
||||||
</li>
|
issues</a>
|
||||||
<li><a href="#Stack_Size">Preventing Stack Size Issues</a></li>
|
</li>
|
||||||
<li><a href="#AOT_Fails">Fixing AOT Compilation Issues</a></li>
|
|
||||||
<li><a href="#Reporting_Problems">Reporting Problems</a></li>
|
<li>
|
||||||
</ol>
|
<a href="#Error_Handling">Error handling</a>
|
||||||
<h2>See also</h2>
|
</li>
|
||||||
<ol>
|
|
||||||
<li><a href="http://source.android.com/devices/tech/dalvik/art.html">Introducing ART</a></li>
|
<li>
|
||||||
<li><a
|
<a href="#Object_Model_Changes">Object model changes</a>
|
||||||
href="http://android-developers.blogspot.com/2011/07/debugging-android-jni-with-checkjni.html">Debugging
|
</li>
|
||||||
Android JNI with CheckJNI</a></li>
|
</ol>
|
||||||
</ol>
|
</li>
|
||||||
</div>
|
|
||||||
|
<li>
|
||||||
|
<a href="#Stack_Size">Preventing Stack Size Issues</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#AOT_Fails">Fixing AOT Compilation Issues</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#Reporting_Problems">Reporting Problems</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
See also
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<a href=
|
||||||
|
"http://source.android.com/devices/tech/dalvik/art.html">Introducing
|
||||||
|
ART</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href=
|
||||||
|
"http://android-developers.blogspot.com/2011/07/debugging-android-jni-with-checkjni.html">
|
||||||
|
Debugging Android JNI with CheckJNI</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>With Android 4.4, we are beginning to roll out a new Android runtime,
|
<p>
|
||||||
<strong>ART</strong>. This runtime offers a number of new features that improve
|
The Android runtime (ART) is the default runtime for devices running Android
|
||||||
performance and smoothness of the Android platform and apps. (You can find more
|
5.0 (API level 21) and higher. This runtime offers a number of features
|
||||||
information about ART's new features in <a
|
that improve performance and smoothness of the Android platform and apps.
|
||||||
href="http://source.android.com/devices/tech/dalvik/art.html">Introducing
|
You can find more information about ART's new features in <a href=
|
||||||
ART</a>.)</p>
|
"http://source.android.com/devices/tech/dalvik/art.html">Introducing
|
||||||
|
ART</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>Currently, ART is available on a number of Android 4.4 devices, such as the
|
<p>
|
||||||
Nexus 4, Nexus 5, Nexus 7, and Google Play edition devices.
|
However, some techniques that work on Dalvik do not work on ART. This
|
||||||
At this time, all devices still use Dalvik as the default runtime. We encourage
|
document lets you know about things to watch for when migrating an existing
|
||||||
you to test your apps for ART compatibility and to take advantage of ART's new
|
app to be compatible with ART. Most apps should just work when running with
|
||||||
features. However, for the time being, you should also take care to maintain
|
ART.
|
||||||
compatibility with Dalvik.</p>
|
</p>
|
||||||
|
|
||||||
<p>This document lets you know about things to watch for when migrating an
|
|
||||||
existing app to be compatible with ART. Most apps should just work when
|
|
||||||
running with ART. However, some techniques that work on Dalvik do not work on
|
|
||||||
ART. This document discusses some of these issues.</p>
|
|
||||||
|
|
||||||
<h2 id="GC_Migration">Addressing Garbage Collection (GC) Issues</h2>
|
<h2 id="GC_Migration">Addressing Garbage Collection (GC) Issues</h2>
|
||||||
|
|
||||||
@@ -147,7 +169,7 @@ in use, this can lead to memory corruption or other problems. For example:</p>
|
|||||||
|
|
||||||
<h3 id="Error_Handling">Error handling</h3>
|
<h3 id="Error_Handling">Error handling</h3>
|
||||||
|
|
||||||
<p>ART's JNI throws errors in a number of cases where Dalvik didn’t. (Once
|
<p>ART's JNI throws errors in a number of cases where Dalvik doesn’t. (Once
|
||||||
again, you can catch many such cases by testing with CheckJNI.)</p>
|
again, you can catch many such cases by testing with CheckJNI.)</p>
|
||||||
|
|
||||||
<p>For example, if <code>RegisterNatives</code> is called with a method that
|
<p>For example, if <code>RegisterNatives</code> is called with a method that
|
||||||
|
|||||||
@@ -262,27 +262,6 @@ toc:
|
|||||||
value: ICU4J Android 框架 API
|
value: ICU4J Android 框架 API
|
||||||
- name: zh-tw-lang
|
- name: zh-tw-lang
|
||||||
value: ICU4J Android 架構 API
|
value: ICU4J Android 架構 API
|
||||||
- title: Java 8 Language Features
|
|
||||||
path: /preview/j8-jack.html
|
|
||||||
path_attributes:
|
|
||||||
- name: es-lang
|
|
||||||
value: Funciones del lenguaje Java 8
|
|
||||||
- name: in-lang
|
|
||||||
value: Fitur Bahasa Java 8
|
|
||||||
- name: ja-lang
|
|
||||||
value: Java 8 の機能
|
|
||||||
- name: ko-lang
|
|
||||||
value: Java 8 언어 기능
|
|
||||||
- name: pt-br-lang
|
|
||||||
value: Recursos de linguagem do Java 8
|
|
||||||
- name: ru-lang
|
|
||||||
value: Возможности языка Java 8
|
|
||||||
- name: vi-lang
|
|
||||||
value: Tính năng của Ngôn ngữ Java 8
|
|
||||||
- name: zh-cn-lang
|
|
||||||
value: Java 8 语言功能
|
|
||||||
- name: zh-tw-lang
|
|
||||||
value: Java 8 語言功能
|
|
||||||
- title: Android for Work Updates
|
- title: Android for Work Updates
|
||||||
path: /preview/features/afw.html
|
path: /preview/features/afw.html
|
||||||
- title: Scoped Directory Access
|
- title: Scoped Directory Access
|
||||||
|
|||||||
Reference in New Issue
Block a user