LoginSignup
2
1

More than 3 years have passed since last update.

AndroidエミュレーターでNativeScript-Vueアプリを起動するまでの手順

Posted at

概要

nativescript-vueアプリの開発中に期間が開くと、Andoroidエミュレーターでアプリ起動する方法を忘れてしまうので、自分用にメモ。

手順

1. Android仮想マシンの確認

avdmanager list avdコマンドで作成済み仮想マシンの確認。
実行例。

> avdmanager list avd
Parsing C:\Android\android-sdk\build-tools\28.0.3\package.xmlParsing 
 :
C:\Android\android-sdk\tools\package.xmlAvailable Android Virtual Devices:
    Name: test
    Path: C:\Users\xxx\.android\avd\test.avd
  Target: Google APIs (Google Inc.)
          Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86
---------
    Name: test2
    Path: C:\Users\kohe5\.android\avd\test2.avd
  Target: Google APIs (Google Inc.)
          Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86_64

The following Android Virtual Devices could not be loaded:
    Name: Pixel3a
    Path: C:\Users\xxx\.android\avd\Pixel3a.avd
   Error: Google pixel_3a no longer exists as a device

emulator -list-avdsコマンドだと簡易に仮想マシンの名称のみ確認ができる。
実行例。

> emulator -list-avds
test
test2

2. Android仮想マシンの起動

emulator -avdで仮想マシン名を指定して起動。
実行例

> emulator -avd test2
ANGLE: D3D11: rx::Renderer11::generateConfigs
emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
Failed to open /qemu.conf, err: 2
:
:

emulator: INFO: QtLogger.cpp:68: Warning: QWindowsWindow::setGeometry: Unable to set geometry 71x559+424+221 on QWidgetWindow/'ToolControlsWindow'. Resulting geometry:  107x839+424+221 (frame: 0, 0, 0, 0, custom margin: 0, 0, 0, 0, minimum size: 71x559, maximum size: 71x559). ((null):0, (null))


Your emulator is out of date, please update by launching Android Studio:
 - Start Android Studio
 - Select menu "Tools > Android > SDK Manager"
 - Click "SDK Tools" tab
 - Check "Android Emulator" checkbox
 - Click "OK"

3. NativeScrit側からアプリをインストールするAndroid仮想マシンの確認

tns deviceコマンドで確認。起動中のデバイスが表示される。
実行例。

> tns device

Connected devices & emulators
Searching for devices...
iTunes is not installed. Install it on your system and run this command again.
┌───┬─────────────┬──────────┬───────────────────┬──────────┬───────────┬─────────────────┐
│ # │ Device Name │ Platform │ Device Identifier │ Type     │ Status    │ Connection Type │
│ 1 │ test2       │ Android  │ emulator-5554     │ Emulator │ Connected │ Local           │
└───┴─────────────┴──────────┴───────────────────┴──────────┴───────────┴─────────────────┘

4. アプリ起動

開発中プロジェクトの直下でtns run --deviceを実行。
deviceのうち#1を指定して実行した例。

> tns run --device 1
Searching for devices...
Your application will be deployed only on the device specified by the provided index or identifier.
Preparing project...
Bundling application for entryPath .\main...
File change detected. Starting incremental webpack compilation...

webpack is watching the files…

[BABEL] Note: The code generator has deoptimised the styling of 
:

    + 345 hidden modules
Webpack compilation complete. Watching for file changes.
Webpack build done!
Project successfully prepared (android)
Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Successfully transferred runtime.js on device emulator-5554.
Restarting application on device emulator-5554...
Successfully synced application org.nativescript.application on device emulator-5554.
JS: HMR: Hot Module Replacement Enabled. Waiting for signal.
JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> CreateElement(NativeFram

参考ページ

2
1
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
2
1