简体   繁体   中英

Ionic v2 build app

I'm trying to build my Ionic 2 app to get a .apk but I don't know if I can get it the same way as Ionic 1 (my app runs with Chrome Developper Tools actually).

In the documentation : http://ionicframework.com/docs/v2/getting-started/installation/ it says to do ionic run android to build.I only have the emulator correctly displayed but my app is not running in it and I don't see any .apk in my app folder.

I tried the Ionic 1 way, cordova build --release android as it is sayed here http://ionicframework.com/docs/guide/publishing.html but after few minutes of many .jar downloads I got this error:

 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"

Can someone help me manage it ?

Thanks by advance !

try to run the following command

ionic build android --release

and you get the apk in MyApp\\platforms\\android\\build\\outputs\\apk

如果ionic run android后未显示任何错误,则应在此文件夹中找到.apk

MyApp\\platforms\\android\\build\\outputs\\apk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM