ionic3 创建 ionic1项目

字数 255阅读 1498

正常创建ionic项目

如果你打开了这篇文章,意味着你起码已经知道正常创建ionic项目的步骤了
就像这样   ionic start myApp tabs
然后如果你想创建一个 Android 应用的话,再执行下面的代码
cd myApp
ionic platform add android
ionic build android
ionic emulate android
但是在 ionic3 里面这样是不行的

ionic3 下创建 ionic1 的项目

首先我们先创建一个项目,它的语法是这样的
ionic start app tabs --type=ionic1
如下图所示

创建项目

然后添加平台,注意看下图,我们先尝试下
ionic platform add android
报错了,运行不下去了,看看蓝框内的提示,我们试试这种写法
ionic cordova platform add android
嗯,成功了

添加平台

然后开始第三步吧,ionic build android,好像又出问题了
看看提示,它说 perhaps you meant ionic cordova build android?,没错,我就是这个意思
敲一下ionic cordova build android,下面一串看起来不像成功的样子
好吧,照着提示试试这句呢cordova build android,成了

build

漫长的下载过程,,,等待过程中顺便写了这篇笔记,等待之后迎来了报错

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/
4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap


* 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
(node:9352) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/
4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap


* 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
(node:9352) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
 Node.js process with a non-zero exit code.

报错了

在网上找了很久的解决方法,终于找到了这里,解决方法如下
解决方法

好吧,我们尝试一下
解决方法

然后打开命令行,这一句ionic cordova build android现在可以用了,弹出了好多下载信息,结局也是很令人欣慰的
成功了

来运行下试试,不出所料ionic emulate android这一句是不行的

运行

根据提示,我们运行ionic cordova emulate android这一句,成功了
成功了

打开虚拟机,看着成功的界面,感动的冒泡
感动的冒泡

推荐阅读更多精彩内容