Ionic2 android build


#1

Hi, I’m trying to build my ionic2 app as an android apk.

cordova build --release android (or) ionic build android

but the command stopped after build:before gulp task.

I got this error, don’t know if it’s sptop the process or just a warning :
(node:18824) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

I tried other node version 6.x, same problem…

Cordova CLI: 5.1.1 Ionic Framework Version: 2.0.0-beta.9 Ionic CLI Version: 2.0.0-beta.31 Ionic App Lib Version: 2.0.0-beta.17 OS: Windows 7 SP1 Node Version: v6.2.0


#2

This is a node 6x issue.
Node 6x introduced a lot of new changes and broke many npm modules, and some haven’t updated yet.

Best bet would be to downgrade to node 5x.


#3

ok it works, but I still don’t have any android compilation… it comes from my conf?


#4

Any error message? the APK should be in platforms/android/build/outputs/apk/


#5

No message at all :

prompt>ionic build android

Running 'build:before' gulp task before build
[18:22:17] Starting 'clean'...
[18:22:17] Finished 'clean' after 116 ms
[18:22:17] Starting 'build'...
[18:22:17] Starting 'sass'...
[18:22:17] Starting 'html'...
[18:22:17] Starting 'fonts'...
[18:22:17] Starting 'scripts'...
[18:22:17] Finished 'scripts' after 126 ms
[18:22:17] Finished 'fonts' after 179 ms
[18:22:17] Finished 'html' after 212 ms
[18:22:18] Finished 'sass' after 1.28 s
[18:22:37] Finished 'build' after 20 s
[18:22:37] Starting 'build:before'...
[18:22:37] Finished 'build:before' after 8.62 µs

prompt>

#6

Maybe a Node 6.x problem, downgrade it as Mike suggested :wink:


#7

@matheo i did it, with node v5.11 the error doesn’t occurs, but I still don’t have any android compilation, and no android/build folder…

I’ve created a new project, to test with a basic configuration, and the build command do not generate any apk, log, error…

prompt>ionic start myapp --v2 --ts
...
prompt>cd myapp
prompt>ionic platform add android
...
prompt>ionic build android

Running 'build:before' gulp task before build
[09:39:23] Starting 'clean'...
[09:39:23] Finished 'clean' after 19 ms
[09:39:23] Starting 'build'...
[09:39:23] Starting 'sass'...
[09:39:23] Starting 'html'...
[09:39:23] Starting 'fonts'...
[09:39:23] Starting 'scripts'...
[09:39:23] Finished 'html' after 134 ms
[09:39:23] Finished 'scripts' after 137 ms
[09:39:23] Finished 'fonts' after 183 ms
[09:39:25] Finished 'sass' after 2.28 s
[09:39:39] Finished 'build' after 16 s
[09:39:39] Starting 'build:before'...
[09:39:39] Finished 'build:before' after 46 µs
prompt>

#8

You have a big issue if you don’t have the platforms/android folder and ionic is not trying to download it before build. Run:

ionic platform add android

then try again. Be sure you have your android sdk correctly installed, as ANDROID_HOME and JAVA_HOME environment variables are required.


#9

the android platform exist, and android_home, java_home, path are setted…

myapp>ls platforms\android
AndroidManifest.xml  CordovaLib  assets  build.gradle  cordova  libs  platform_www  project.properties  res  settings.gradle  src

myapp>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_45

myapp>echo %ANDROID_HOME%
C:\Programmes\Android\sdk

myapp>echo %PATH%
C:\Programmes\Android\sdk\platform-tools;C:\Programmes\Android\sdk\tools;[...]

I don’t unerstand why there are no error message, it’s like the command doesn’t call at all any build process and end normally


#10

@matheo @mhartington do not work with node v5.11.1 but works with v5.6.0.
Sorry for all this posts and thanks for your help!