1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ionicでcordova buildできなかったときにしたこと

1
Last updated at Posted at 2018-11-10

Windowsでionicの次のコマンドでAndroidのapkを作成しようとしたときに発生したエラーを解決しましたので、簡易的なメモですが備忘のため記録します。

ionic cordova build android

対処概要

  • Android Studio インストール
  • adbのパスを環境変数に追加
  • javaのパスを環境変数に追加
  • Android イメージダウンロード

対処内容

Android Studio インストール

以下のURLの「DOWNLOAD ANDROID STUDIO」ボタンをクリックしてダウンロード。

ダウンロードしたファイルを実行してインストール。

adbのパスを環境変数に追加

以下のパスを環境変数に追加。

C:\Users\[ユーザー名]\AppData\Local\Android\Sdk\platform-tools

javaのパスを環境変数に追加

以下のパスを環境変数に追加。
※Javaを他で利用していないため、Android Studio依存のパスですが許容しています

C:\Program Files\Android\Android Studio\jre\bin

Android イメージダウンロード

以下のエラーが出た場合には、
対象のイメージがダウンロードできていないのでダウンロードします。

BUILD FAILED in 1m 41s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Platform 27].
  Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
  Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

Android Studioで初めてプロジェクトを作成して、
エミュレータで実行するときに規約に同意してイメージをダウンロードすれば
OKでした。

成功すると次のようなメッセージが表示されます。

BUILD SUCCESSFUL in 1s
46 actionable tasks: 1 executed, 45 up-to-date
Built the following apk(s):
        [プロジェクトルート]\platforms\android\app\build\outputs\apk\debug\app-debug.apk

何かのお役に立てれば幸いです。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?