LoginSignup
3
5

More than 5 years have passed since last update.

Android 8.0.0(Oreo) Emulator build 手順

Posted at

Android 8.0.0(Oreo)のframeworkの調査を行う為、Emulator buildを行ったので、
その手順をメモ。

build環境構築

The Android Source Code
を参考に構築してください。

Android 8.0.0(Oreo) のSource Code取得

どこかの作業フォルダー内で下記コマンドを実行。

$ repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r34
$ repo sync -j12

現状の内容ではEmulatorが起動しない為、コードを修正

1.Emulator用のライブラリ読み込みパス修正Patch
https://android.googlesource.com/platform/frameworks/native/+/3adf9e1403bee30d1ef79c3a8cf310292df4745f
のpatchを適用する必要があります。
下記コマンドでPatchを適用してください。

$ cd frameworks/native
$ git fetch https://android.googlesource.com/platform/frameworks/native refs/changes/50/471850/1 && git cherry-pick FETCH_HEAD
$ cd ../../

2.設定アプリを開くとクラッシュする為クラッシュメソッドを呼ばないように修正
packages/apps/Settings/src/com/android/settings/wfd/WifiDisplaySettings.javaの
public static boolean isAvailable(Context context)内のontext.getSystemService(Context.WIFI_P2P_SERVICE)を呼ばないように修正してください。

WifiDisplaySettings.java
public static boolean isAvailable(Context context) {
    return context.getSystemService(Context.DISPLAY_SERVICE) != null
            && context.getSystemService(Context.WIFI_P2P_SERVICE) != null;
}

ビルド手順

下記コマンドでビルドを行います。

$ source build/envsetup.sh
$ lunch aosp_x86-eng
$ make -j4

Emulator起動

下記コマンドで起動。

$ emulator

Android StudioのEmulatorで起動する方法

Android SDK Path(Android SDK Location)内の"system-images/android-26/google_apis/x86"
の中にある
・ramdisk.img
・system.img
・userdata.img
をビルドしたイメージで上書きする。
AVD ManagerのCreate Virtual Deviceで上書きしたイメージで作成し起動する。

3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5