はじめに!
この記事の環境は以下です、あとmacはまだ持ってないので、iOSのことは近々mac買ってから書きますので、とりあえずAndroid主役です
Ionic4
Windows 10 Home x64
わたしはWeb系システムの開発経験(HTML、CSS、PHP、MySQL、JS、jQuery)とちょこっとpythonとかPerlを触ったことある程度だったんですが、今回スマホアプリを制作する機会が発生しまして、そんな私でもサクっと出来ないものかと調べたところ、ionicとやらが良さそう、ということだったんで使ってみたいと思います
PWAというのも惹かれるところがあったんですが、現時点でiOSのデフォルトブラウザであるsafariが未対応とのことらしいので、あえなく却下となりました
Ionicとはなんぞや?それに付随してcordovaとは?Angularとは?みたいなご説明に関しては、その他の色んなサイトにありそうなので割愛します!ヽ( ´∇`)ノ
読み方だけはあまり記載されてるサイトがなかったので書いておきますね
Ionic(アイオニック)
cordova(コルドバ)
Angular(アンギュラー)
・・・たぶんあってると思います|д・´)
それよりもなによりも、Ionic4の記事が載ってるサイト、特に日本語サイトがあまりなくて、わりと辛かったのでまとめていきたいと思います(>_<)
なにはともあれ環境構築
わたしと同じ初めて触れる初心者の気持ちになって書きます、色々調べてみたサイトでは省略して欲しくない~ってところが省略されてたりしたので、冗長かもしれませんが、あしからず
Node.js
Node.jsが入ってることが大前提らしいっす、ここ皆さん大前提なので当然入ってるらしく省略されてますが、わたしは初めて入れたので、書いておきます
まずは公式サイトから、バージョンにあったインストーラを落としてきます
そしたら、インストーラを起動して、いつもの次へ次へ作業です、わたしは特に変更していません
最後にバージョン確認して、無事インスコできたことを見てNode.jsは終わりです(*`・ω・)ゞ
C:\>node -v v8.12.0 C:\>npm -v 6.4.1
お次はcordovaのインストール
コマンド実行するだけです
C:\Users\XXXX>npm install -g cordova C:\Users\XXXX\AppData\Roaming\npm\cordova -> C:\Users\XXXX\AppData\Roaming\npm\node_modules\cordova\bin\cordova + cordova@8.1.2 added 594 packages from 523 contributors in 35.958s C:\Users\XXXX>
このタイミングで、試しにcordovaでプロジェクト作成をやってみました、ここは不要かもしれませんが動作確認みたいなもんですかね(*´・∀・)
今回はIonicでやってくので、バージョンだけ確認して次に行ってもいいのかもしれません、が初めての方はわたしと一緒にやっていきましょう、以降の流れで私は進めてしまったので!
helloworldというプロジェクトを作成します
C:\work\program\cordova\test>cordova create helloworld ? May Cordova anonymously report usage statistics to improve the tool over time? (Y/n) y You have been opted out of telemetry. To change this, run: cordova telemetry on. Creating a new cordova project.
直下にhelloworldというディレクトリが出来ているので、見てみます
C:\work\program\cordova\test>dir ドライブ C のボリューム ラベルは Windows です ボリューム シリアル番号は 5405-7EBD です C:\work\program\cordova\test のディレクトリ 2018/10/12 15:44 <DIR> . 2018/10/12 15:44 <DIR> .. 2018/10/12 15:44 <DIR> helloworld 0 個のファイル 0 バイト 3 個のディレクトリ 126,457,585,664 バイトの空き領域 C:\work\program\cordova\test>cd helloworld C:\work\program\cordova\test\helloworld>dir ドライブ C のボリューム ラベルは Windows です ボリューム シリアル番号は 5405-7EBD です C:\work\program\cordova\test\helloworld のディレクトリ 2018/10/12 15:44 <DIR> . 2018/10/12 15:44 <DIR> .. 2018/10/12 15:44 17 .npmignore 2018/10/12 15:44 992 config.xml 2018/10/12 15:44 <DIR> hooks 2018/10/12 15:44 361 package.json 2018/10/12 15:44 <DIR> platforms 2018/10/12 15:44 <DIR> plugins 2018/10/12 15:44 <DIR> res 2018/10/12 15:44 <DIR> www 3 個のファイル 1,370 バイト 7 個のディレクトリ 126,457,339,904 バイトの空き領域
ここまで来たところで、わたしは一旦ビルドしてみたんですが、どうやら先にAndroid Studio入れないとエラーになるようです(>_<)
続いてそちらをいれましょう
Android Studioのインストール
インストーラを実行して、また次へ次へタイム、こちらもわたしは全てデフォルトです
Android Studio起動で、設定していきます
っで、ちょっと長いですが、まだやっていきますよ~
プロジェクト開始するぞ~っていう画面になるので、このタイミングで一旦立ち上げておきます、恐らくですが後々やることになりますんで( ´・ω・`)
とりあえず新規プロジェクトたちあげられれば良いので、デフォルトな感じでドシドシやっちゃいます٩( ‘ω’ )و
ここまでくればオッケーです!
そして、「ANDROID_HOME」という環境変数も新規に作成しておきます、パスはAndroid SDKが入ってる場所、わたしの場合は↓です。ユーザー名のところは置き換えてどうぞ
いよいよcordovaでビルドするぞー
さっき作ったhelloworldプロジェクトでビルドしてみましょう!
コマンドプロンプトでさっきのディレクトリに戻って以下を打鍵、ちょっとここメッセージが大量なんですけど、参考のためにわたしの環境で出た標準出力を全部載せておきますね、自分の環境でやってみて、特に問題なければサッーっと流してください
C:\work\program\cordova\test\helloworld>cordova build android Android Studio project detected ANDROID_HOME=C:\Users\XXXX\AppData\Local\Android\Sdk JAVA_HOME=C:\Program Files\java\jdk1.8.0_172 studio Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details BUILD SUCCESSFUL in 33s 1 actionable task: 1 executed Subproject Path: CordovaLib Subproject Path: app こっから色々ダウンロードが始まった Downloading https://services.gradle.org/distributions/gradle-4.1-all.zip ..................................................................................... Unzipping C:\Users\XXXX\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew\gradle-4.1-all.zip to C:\Users\XXXX\.gradle\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew Starting a Gradle Daemon (subsequent builds will be faster) Download https://maven.google.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom Download https://maven.google.com/com/android/tools/build/gradle-core/3.0.1/gradle-core-3.0.1.pom Download https://maven.google.com/com/android/tools/lint/lint/26.0.1/lint-26.0.1.pom Download https://maven.google.com/com/android/tools/build/builder/3.0.1/builder-3.0.1.pom Download https://maven.google.com/com/android/tools/build/gradle-api/3.0.1/gradle-api-3.0.1.pom Download https://maven.google.com/com/android/tools/external/org-jetbrains/uast/26.0.1/uast-26.0.1.pom Download https://maven.google.com/com/android/databinding/compilerCommon/3.0.1/compilerCommon-3.0.1.pom Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.1/asm-analysis-5.1.pom Download https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.pom Download https://jcenter.bintray.com/org/ow2/asm/asm/5.1/asm-5.1.pom Download https://jcenter.bintray.com/org/ow2/asm/asm-commons/5.1/asm-commons-5.1.pom Download https://jcenter.bintray.com/org/ow2/asm/asm-parent/5.1/asm-parent-5.1.pom Download https://jcenter.bintray.com/org/ow2/asm/asm-util/5.1/asm-util-5.1.pom Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.3.3/proguard-gradle-5.3.3.pom Download https://jcenter.bintray.com/org/jacoco/org.jacoco.report/0.7.4.201502262128/org.jacoco.report-0.7.4.201502262128.pom Download https://jcenter.bintray.com/org/jacoco/org.jacoco.core/0.7.4.201502262128/org.jacoco.core-0.7.4.201502262128.pom Download https://jcenter.bintray.com/net/sf/proguard/proguard-parent/5.3.3/proguard-parent-5.3.3.pom Download https://jcenter.bintray.com/org/jacoco/org.jacoco.build/0.7.4.201502262128/org.jacoco.build-0.7.4.201502262128.pom Download https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.pom Download https://jcenter.bintray.com/com/google/protobuf/protobuf-parent/3.0.0/protobuf-parent-3.0.0.pom Download https://maven.google.com/com/android/tools/build/builder-test-api/3.0.1/builder-test-api-3.0.1.pom Download https://maven.google.com/com/android/tools/sdklib/26.0.1/sdklib-26.0.1.pom Download https://maven.google.com/com/android/tools/sdk-common/26.0.1/sdk-common-26.0.1.pom Download https://maven.google.com/com/android/tools/build/builder-model/3.0.1/builder-model-3.0.1.pom Download https://maven.google.com/com/android/tools/common/26.0.1/common-26.0.1.pom Download https://maven.google.com/com/android/tools/build/manifest-merger/26.0.1/manifest-merger-26.0.1.pom Download https://maven.google.com/com/android/tools/analytics-library/protos/26.0.1/protos-26.0.1.pom Download https://maven.google.com/com/android/tools/ddms/ddmlib/26.0.1/ddmlib-26.0.1.pom Download https://maven.google.com/com/android/tools/build/apksig/3.0.1/apksig-3.0.1.pom Download https://maven.google.com/com/android/tools/analytics-library/tracker/26.0.1/tracker-26.0.1.pom Download https://maven.google.com/com/android/tools/analytics-library/shared/26.0.1/shared-26.0.1.pom Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.1/asm-tree-5.1.pom Download https://maven.google.com/com/android/tools/lint/lint-checks/26.0.1/lint-checks-26.0.1.pom Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.pom Download https://jcenter.bintray.com/com/google/guava/guava/22.0/guava-22.0.pom Download https://jcenter.bintray.com/com/google/guava/guava-parent/22.0/guava-parent-22.0.pom Download https://maven.google.com/com/android/databinding/baseLibrary/3.0.1/baseLibrary-3.0.1.pom Download https://jcenter.bintray.com/com/android/tools/annotations/24.5.0/annotations-24.5.0.pom Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.3.3/proguard-base-5.3.3.pom Download https://maven.google.com/com/android/tools/dvlib/26.0.1/dvlib-26.0.1.pom Download https://maven.google.com/com/android/tools/layoutlib/layoutlib-api/26.0.1/layoutlib-api-26.0.1.pom Download https://maven.google.com/com/android/tools/repository/26.0.1/repository-26.0.1.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.pom Download https://jcenter.bintray.com/com/google/code/gson/gson/2.3/gson-2.3.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-client/4.1/httpcomponents-client-4.1.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.2.6/httpclient-4.2.6.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-client/4.2.6/httpcomponents-client-4.2.6.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/project/4.1.1/project-4.1.1.pom Download https://maven.google.com/com/android/tools/lint/lint-api/26.0.1/lint-api-26.0.1.pom Download https://jcenter.bintray.com/com/google/errorprone/error_prone_annotations/2.0.18/error_prone_annotations-2.0.18.pom Download https://jcenter.bintray.com/com/google/errorprone/error_prone_parent/2.0.18/error_prone_parent-2.0.18.pom Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.pom Download https://jcenter.bintray.com/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom Download https://jcenter.bintray.com/commons-codec/commons-codec/1.6/commons-codec-1.6.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcore/4.2.5/httpcore-4.2.5.pom Download https://jcenter.bintray.com/org/apache/commons/commons-parent/5/commons-parent-5.pom Download https://jcenter.bintray.com/org/apache/commons/commons-parent/22/commons-parent-22.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-core/4.2.5/httpcomponents-core-4.2.5.pom Download https://jcenter.bintray.com/org/apache/apache/4/apache-4.pom Download https://maven.google.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.pom Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.pom Download https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.pom Download https://jcenter.bintray.com/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom Download https://maven.google.com/com/android/tools/annotations/26.0.1/annotations-26.0.1.pom Download https://maven.google.com/com/android/tools/lint/lint/26.0.1/lint-26.0.1.jar Download https://maven.google.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar Download https://maven.google.com/com/android/tools/build/builder/3.0.1/builder-3.0.1.jar Download https://maven.google.com/com/android/tools/build/gradle-core/3.0.1/gradle-core-3.0.1.jar Download https://maven.google.com/com/android/tools/lint/lint-checks/26.0.1/lint-checks-26.0.1.jar Download https://maven.google.com/com/android/tools/lint/lint-api/26.0.1/lint-api-26.0.1.jar Download https://maven.google.com/com/android/tools/external/org-jetbrains/uast/26.0.1/uast-26.0.1.jar Download https://maven.google.com/com/android/tools/build/gradle-api/3.0.1/gradle-api-3.0.1.jar Download https://maven.google.com/com/android/databinding/compilerCommon/3.0.1/compilerCommon-3.0.1.jar Download https://maven.google.com/com/android/tools/sdk-common/26.0.1/sdk-common-26.0.1.jar Download https://maven.google.com/com/android/tools/build/manifest-merger/26.0.1/manifest-merger-26.0.1.jar Download https://maven.google.com/com/android/tools/repository/26.0.1/repository-26.0.1.jar Download https://maven.google.com/com/android/tools/sdklib/26.0.1/sdklib-26.0.1.jar Download https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar Download https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar Download https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.1/asm-analysis-5.1.jar Download https://jcenter.bintray.com/org/ow2/asm/asm-commons/5.1/asm-commons-5.1.jar Download https://jcenter.bintray.com/org/ow2/asm/asm-util/5.1/asm-util-5.1.jar Download https://jcenter.bintray.com/org/ow2/asm/asm/5.1/asm-5.1.jar Download https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.1/asm-tree-5.1.jar Download https://jcenter.bintray.com/org/jacoco/org.jacoco.report/0.7.4.201502262128/org.jacoco.report-0.7.4.201502262128.jar Download https://jcenter.bintray.com/org/jacoco/org.jacoco.core/0.7.4.201502262128/org.jacoco.core-0.7.4.201502262128.jar Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.3.3/proguard-gradle-5.3.3.jar Download https://maven.google.com/com/android/tools/analytics-library/tracker/26.0.1/tracker-26.0.1.jar Download https://maven.google.com/com/android/tools/analytics-library/shared/26.0.1/shared-26.0.1.jar Download https://maven.google.com/com/android/tools/analytics-library/protos/26.0.1/protos-26.0.1.jar Download https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar Download https://maven.google.com/com/android/tools/layoutlib/layoutlib-api/26.0.1/layoutlib-api-26.0.1.jar Download https://maven.google.com/com/android/tools/build/builder-model/3.0.1/builder-model-3.0.1.jar Download https://maven.google.com/com/android/tools/build/builder-test-api/3.0.1/builder-test-api-3.0.1.jar Download https://maven.google.com/com/android/tools/ddms/ddmlib/26.0.1/ddmlib-26.0.1.jar Download https://maven.google.com/com/android/tools/common/26.0.1/common-26.0.1.jar Download https://maven.google.com/com/android/tools/build/apksig/3.0.1/apksig-3.0.1.jar Download https://maven.google.com/com/android/tools/dvlib/26.0.1/dvlib-26.0.1.jar Download https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.jar Download https://jcenter.bintray.com/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar Download https://maven.google.com/com/android/databinding/baseLibrary/3.0.1/baseLibrary-3.0.1.jar Download https://jcenter.bintray.com/com/google/guava/guava/22.0/guava-22.0.jar Download https://maven.google.com/com/android/tools/annotations/26.0.1/annotations-26.0.1.jar Download https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.3.3/proguard-base-5.3.3.jar Download https://jcenter.bintray.com/com/google/code/gson/gson/2.3/gson-2.3.jar Download https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.2.6/httpclient-4.2.6.jar Download https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.jar Download https://jcenter.bintray.com/com/google/errorprone/error_prone_annotations/2.0.18/error_prone_annotations-2.0.18.jar Download https://jcenter.bintray.com/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar Download https://jcenter.bintray.com/com/intellij/annotations/12.0/annotations-12.0.jar Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcore/4.2.5/httpcore-4.2.5.jar Download https://jcenter.bintray.com/commons-codec/commons-codec/1.6/commons-codec-1.6.jar Download https://maven.google.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar Download https://jcenter.bintray.com/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar Download https://jcenter.bintray.com/com/jfrog/bintray/gradle/gradle-bintray-plugin/1.7.3/gradle-bintray-plugin-1.7.3.pom 1回ここで止まってすげー待たされました Download https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.5/android-maven-gradle-plugin-1.5.pom Download https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.pom Download https://jcenter.bintray.com/org/codehaus/groovy/modules/http-builder/http-builder/0.7.2/http-builder-0.7.2.pom Download https://jcenter.bintray.com/org/apache/maven/maven-parent/19/maven-parent-19.pom Download https://jcenter.bintray.com/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.pom Download https://jcenter.bintray.com/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.pom Download https://jcenter.bintray.com/net/sourceforge/nekohtml/nekohtml/1.9.16/nekohtml-1.9.16.pom Download https://jcenter.bintray.com/net/sf/json-lib/json-lib/2.3/json-lib-2.3.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.2.1/httpclient-4.2.1.pom Download https://jcenter.bintray.com/org/apache/apache/3/apache-3.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-client/4.2.1/httpcomponents-client-4.2.1.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/project/6/project-6.pom Download https://jcenter.bintray.com/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.pom Download https://jcenter.bintray.com/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.pom Download https://jcenter.bintray.com/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.pom Download https://jcenter.bintray.com/org/codehaus/plexus/plexus-containers/1.0.3/plexus-containers-1.0.3.pom Download https://jcenter.bintray.com/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.pom Download https://jcenter.bintray.com/org/apache/ant/ant/1.8.0/ant-1.8.0.pom Download https://jcenter.bintray.com/org/codehaus/plexus/plexus/2.0.2/plexus-2.0.2.pom Download https://jcenter.bintray.com/org/codehaus/plexus/plexus-components/1.1.14/plexus-components-1.1.14.pom Download https://jcenter.bintray.com/org/apache/ant/ant-parent/1.8.0/ant-parent-1.8.0.pom Download https://jcenter.bintray.com/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom Download https://jcenter.bintray.com/org/apache/maven/maven-artifact-manager/2.2.1/maven-artifact-manager-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/maven-model/2.2.1/maven-model-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/maven/2.2.1/maven-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/maven-project/2.2.1/maven-project-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/maven-parent/11/maven-parent-11.pom Download https://jcenter.bintray.com/org/apache/apache/5/apache-5.pom Download https://jcenter.bintray.com/org/apache/maven/maven-error-diagnostics/2.2.1/maven-error-diagnostics-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-http-lightweight/1.0-beta-6/wagon-http-lightweight-1.0-beta-6.pom Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-file/1.0-beta-6/wagon-file-1.0-beta-6.pom Download https://jcenter.bintray.com/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.pom Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-providers/1.0-beta-6/wagon-providers-1.0-beta-6.pom Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon/1.0-beta-6/wagon-1.0-beta-6.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcore/4.2.1/httpcore-4.2.1.pom Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcomponents-core/4.2.1/httpcomponents-core-4.2.1.pom Download https://jcenter.bintray.com/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.pom Download https://jcenter.bintray.com/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.pom Download https://jcenter.bintray.com/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.pom Download https://jcenter.bintray.com/commons-lang/commons-lang/2.4/commons-lang-2.4.pom Download https://jcenter.bintray.com/org/apache/commons/commons-parent/11/commons-parent-11.pom Download https://jcenter.bintray.com/org/apache/commons/commons-parent/9/commons-parent-9.pom Download https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom Download https://jcenter.bintray.com/org/apache/ant/ant-launcher/1.8.0/ant-launcher-1.8.0.pom Download https://jcenter.bintray.com/org/apache/maven/maven-repository-metadata/2.2.1/maven-repository-metadata-2.2.1.pom Download https://jcenter.bintray.com/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.pom Download https://jcenter.bintray.com/org/apache/maven/maven-plugin-registry/2.2.1/maven-plugin-registry-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/maven-profile/2.2.1/maven-profile-2.2.1.pom Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-http-shared/1.0-beta-6/wagon-http-shared-1.0-beta-6.pom Download https://jcenter.bintray.com/junit/junit/3.8.1/junit-3.8.1.pom Download https://jcenter.bintray.com/nekohtml/nekohtml/1.9.6.2/nekohtml-1.9.6.2.pom Download https://jcenter.bintray.com/nekohtml/xercesMinimal/1.9.6.2/xercesMinimal-1.9.6.2.pom Download https://jcenter.bintray.com/org/codehaus/groovy/modules/http-builder/http-builder/0.7.2/http-builder-0.7.2.jar Download https://jcenter.bintray.com/com/jfrog/bintray/gradle/gradle-bintray-plugin/1.7.3/gradle-bintray-plugin-1.7.3.jar Download https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar Download https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.5/android-maven-gradle-plugin-1.5.jar Download https://jcenter.bintray.com/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar Download https://jcenter.bintray.com/net/sourceforge/nekohtml/nekohtml/1.9.16/nekohtml-1.9.16.jar Download https://jcenter.bintray.com/net/sf/json-lib/json-lib/2.3/json-lib-2.3-jdk15.jar Download https://jcenter.bintray.com/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.jar Download https://jcenter.bintray.com/org/apache/ant/ant/1.8.0/ant-1.8.0.jar Download https://jcenter.bintray.com/org/apache/maven/maven-project/2.2.1/maven-project-2.2.1.jar Download https://jcenter.bintray.com/org/apache/maven/maven-artifact-manager/2.2.1/maven-artifact-manager-2.2.1.jar Download https://jcenter.bintray.com/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar Download https://jcenter.bintray.com/org/apache/maven/maven-error-diagnostics/2.2.1/maven-error-diagnostics-2.2.1.jar Download https://jcenter.bintray.com/org/apache/maven/maven-profile/2.2.1/maven-profile-2.2.1.jar Download https://jcenter.bintray.com/org/apache/maven/maven-plugin-registry/2.2.1/maven-plugin-registry-2.2.1.jar Download https://jcenter.bintray.com/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar Download https://jcenter.bintray.com/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar Download https://jcenter.bintray.com/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.jar Download https://jcenter.bintray.com/org/apache/maven/maven-model/2.2.1/maven-model-2.2.1.jar Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-http-lightweight/1.0-beta-6/wagon-http-lightweight-1.0-beta-6.jar Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-file/1.0-beta-6/wagon-file-1.0-beta-6.jar Download https://jcenter.bintray.com/org/apache/maven/maven-repository-metadata/2.2.1/maven-repository-metadata-2.2.1.jar Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-http-shared/1.0-beta-6/wagon-http-shared-1.0-beta-6.jar Download https://jcenter.bintray.com/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.jar Download https://jcenter.bintray.com/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar Download https://jcenter.bintray.com/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar Download https://jcenter.bintray.com/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar Download https://jcenter.bintray.com/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar Download https://jcenter.bintray.com/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar Download https://jcenter.bintray.com/commons-lang/commons-lang/2.4/commons-lang-2.4.jar Download https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar Download https://jcenter.bintray.com/junit/junit/3.8.1/junit-3.8.1.jar Download https://jcenter.bintray.com/org/apache/ant/ant-launcher/1.8.0/ant-launcher-1.8.0.jar Download https://jcenter.bintray.com/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar Download https://jcenter.bintray.com/nekohtml/nekohtml/1.9.6.2/nekohtml-1.9.6.2.jar Download https://jcenter.bintray.com/nekohtml/xercesMinimal/1.9.6.2/xercesMinimal-1.9.6.2.jar publishNonDefault is deprecated and has no effect anymore. All variants are now published. File C:\Users\XXXX\.android\repositories.cfg could not be loaded. Checking the license for package Android SDK Platform 27 in C:\Users\XXXX\AppData\Local\Android\Sdk\licenses 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 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. * Get more help at https://help.gradle.org BUILD FAILED in 13m 15s Warning: License for package Android SDK Platform 27 not accepted. 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 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. * Get more help at https://help.gradle.org BUILD FAILED in 13m 15s
よしよし、終わったぞ~っと思ったら失敗してるやん!(; ・`д・´)
一応、ここまでに13分15秒かかったようです、遅くてもある程度放置しておくのがいいかなと思います
っで、肝心のエラーですが、何やら色々調べた結果、Android SDKのインストールに際してライセンスの同意がされてませんよーってエラーのようです、勝手にCUIでダーッとやってるのに、同意ってなんやねんって感じですよね
色々とググったサイトでは、ライセンス同意済みのファイルか何かを引っ張って来て、もっかいCUIで実行!みたいな記事が出てきたんですが、まあようするにAndroid SDKの27が入れられればOKってことです!
なんで、わたしはGUIのAndroid StudioのSDKマネージャーってやつから入れました(*´∀`*)
Android Studioのプロジェクト画面を開きます、このプロジェクトが存在する状態でないと恐らくToolsにSDK Manager(およびのちに使うAVD Manager)が出てきません。ですので、とりあえずなんでもいいので、さっきプロジェクトを作った感じです
わたしのエラーは[Android SDK Platform 27]って出てたんで、API Levelが27のOreoさんを入れます
ここ↓で同意できますね!
あとは流れ作業
よっしゃー、準備整ったで~ってことで再度ビルド!今度は標準出力ちょっと省略します
C:\work\program\cordova\test\helloworld>cordova build android ~省略~ BUILD SUCCESSFUL in 50s 46 actionable tasks: 46 executed Built the following apk(s): C:\work\program\cordova\test\helloworld\platforms\android\app\build\outputs\apk\debug\app-debug.apk
サクセーッス!おっけーい、今度はもろもろのダウンロードがないのでサクっと50秒でおわりました(*`・ω・)ゞ
起動してみましょう!!
ビルドしたapkを立ち上げてみます
まずはapkを上げるためにAndroidエミュレータを起動します
先ほどと同じく、プロジェクトの画面からAVD Managerを選択
細かい設定がいろいろ出来るようですが、一旦この辺は流れのまま進みました
ここまで来たら↑の画面の右端、Actionsのところの▶ボタンを押します!
なんか上がってきた~
ここまで来たらようやっと起動できます╭(๑•̀ㅂ•́)و
C:\work\program\cordova\test\helloworld>cordova run android Android Studio project detected ANDROID_HOME=C:\Users\XXXX\AppData\Local\Android\Sdk JAVA_HOME=C:\Program Files\java\jdk1.8.0_172 studio Subproject Path: CordovaLib Subproject Path: app publishNonDefault is deprecated and has no effect anymore. All variants are now published. The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. at build_deedpkndxs7jyh3vrpcoo4pjp.run(C:\work\program\cordova\test\helloworld\platforms\android\app\build.gradle:143) :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild UP-TO-DATE :CordovaLib:compileDebugAidl UP-TO-DATE :CordovaLib:compileDebugRenderscript UP-TO-DATE :CordovaLib:checkDebugManifest UP-TO-DATE :CordovaLib:generateDebugBuildConfig UP-TO-DATE :CordovaLib:prepareLintJar UP-TO-DATE :CordovaLib:generateDebugResValues UP-TO-DATE :CordovaLib:generateDebugResources UP-TO-DATE :CordovaLib:packageDebugResources UP-TO-DATE :CordovaLib:platformAttrExtractor UP-TO-DATE :CordovaLib:processDebugManifest UP-TO-DATE :CordovaLib:processDebugResources UP-TO-DATE :CordovaLib:generateDebugSources UP-TO-DATE :CordovaLib:javaPreCompileDebug UP-TO-DATE :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE :CordovaLib:processDebugJavaRes NO-SOURCE :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl UP-TO-DATE :CordovaLib:packageDebugRenderscript NO-SOURCE :app:compileDebugRenderscript UP-TO-DATE :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:prepareLintJar UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:createDebugCompatibleScreenManifests UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:splitsDiscoveryTaskDebug UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:javaPreCompileDebug UP-TO-DATE :app:compileDebugJavaWithJavac UP-TO-DATE :app:compileDebugNdk NO-SOURCE :app:compileDebugSources UP-TO-DATE :CordovaLib:mergeDebugShaders UP-TO-DATE :CordovaLib:compileDebugShaders UP-TO-DATE :CordovaLib:generateDebugAssets UP-TO-DATE :CordovaLib:mergeDebugAssets UP-TO-DATE :app:mergeDebugShaders UP-TO-DATE :app:compileDebugShaders UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:transformClassesWithStackFramesFixerForDebug UP-TO-DATE :app:transformClassesWithDesugarForDebug UP-TO-DATE :app:transformClassesWithDexBuilderForDebug UP-TO-DATE :app:transformDexArchiveWithExternalLibsDexMergerForDebug UP-TO-DATE :app:transformDexArchiveWithDexMergerForDebug UP-TO-DATE :CordovaLib:compileDebugNdk NO-SOURCE :CordovaLib:mergeDebugJniLibFolders UP-TO-DATE :CordovaLib:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE :CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug UP-TO-DATE :app:mergeDebugJniLibFolders UP-TO-DATE :app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE :app:processDebugJavaRes NO-SOURCE :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE :app:validateSigningDebug :app:packageDebug UP-TO-DATE :app:assembleDebug UP-TO-DATE :app:cdvBuildDebug UP-TO-DATE BUILD SUCCESSFUL in 2s 46 actionable tasks: 1 executed, 45 up-to-date Built the following apk(s): C:\work\program\cordova\test\helloworld\platforms\android\app\build\outputs\apk\debug\app-debug.apk ANDROID_HOME=C:\Users\XXXX\AppData\Local\Android\Sdk JAVA_HOME=C:\Program Files\java\jdk1.8.0_172 No target specified and no devices found, deploying to emulator No emulator images (avds) found. 1. Download desired System Image by running: "C:\Users\XXXX\AppData\Local\Android\Sdk\tools\android.bat" sdk 2. Create an AVD by running: "C:\Users\XXXX\AppData\Local\Android\Sdk\tools\android.bat" avd HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver
ごめんなさい、ここテキストログがエミュ起動してないときのやつしか残してませんでした・・うまくいった時はスクショだけなんですが↓な感じでした
すると、さっきのAndroidエミュの方でapkが勝手に起動します
きた~~~、これで起動はおっけーです!長かった~~。:.゚ヽ(´∀`。)ノ゚.:。 ゜
ごめんなさい、記事もめっちゃ長くなってきてしまったんで、Ionic以降はまた別記事にします!|д・´)
まだ、Ionic全く出てきてない・・・
関連記事
ionic4 – ハイブリッドアプリ制作にチャレンジしてみる①
ionic4 – ハイブリッドアプリ制作にチャレンジしてみる②
ionic4 – ハイブリッドアプリ制作にチャレンジしてみる③ – ページ遷移
ionic4 – ハイブリッドアプリ制作にチャレンジしてみる④ – FCMによるPUSH通知