Ionic v2构建应用

时间:2016-07-03 11:50:32

标签: android cordova ionic-framework ionic2

我正在尝试构建我的Ionic 2应用程序来获取.apk,但我不知道我是否可以像Ionic 1那样获得它(我的应用程序实际上是使用Chrome Developper Tools运行)。

在文档中:http://ionicframework.com/docs/v2/getting-started/installation/它说要ionic run android进行构建。我只是正确显示了模拟器,但我的应用程序没有在其中运行,我也看不到任何.apk在我的app文件夹中。

我尝试了Ionic 1方式cordova build --release android,因为它在这里说http://ionicframework.com/docs/guide/publishing.html但是经过几分钟的许多.jar下载我得到了这个错误:

 FAILED
 Exception in thread "main"

 FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe''
finished with non-zero exit value 1

* Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug
 option to get more log output.

BUILD FAILED

Total time: 23.223 secs
Error: Error code 1 for command: cmd with args: /s,/c,"C:\PATH\app\platforms\android\gradlew
cdvBuildRelease -b C:\PATH\app\platforms\android\build.gradle 
-Dorg.gradle.daemon=true
-Pandroid.useDeprecatedNdk=true"

有人可以帮我管理吗?

先谢谢!

2 个答案:

答案 0 :(得分:2)

尝试运行以下命令

ionic build android --release

你在MyApp \ platforms \ android \ build \ outputs \ apk

获取apk

答案 1 :(得分:0)

如果在运行ionic run android后没有显示错误,您应该在此文件夹中找到.apk

MyApp\platforms\android\build\outputs\apk