ionic3 创建 ionic1项目
2018-01-07 本文已影响49人
邪人君子
简介
可能你和我一样觉得降级太麻烦,而且老是报错,这篇文章就介绍一下在 ionic3 下创建 ionic1 项目的方法
正常创建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
这一句,成功了成功了
打开虚拟机,看着成功的界面,感动的冒泡
感动的冒泡