ionic build android failed


#1

Error:

[16:43:44] ionic-app-scripts 1.3.7
[16:43:44] build dev started ...
[16:43:44] clean started ...
[16:43:44] clean finished in 8 ms
[16:43:44] copy started ...
[16:43:44] transpile started ...
[16:43:49] transpile finished in 4.51 s
[16:43:49] preprocess started ...
[16:43:49] deeplinks started ...
[16:43:49] deeplinks finished in 17 ms
[16:43:49] preprocess finished in 18 ms
[16:43:49] webpack started ...
[16:43:49] copy finished in 5.01 s
[16:44:03] webpack finished in 14.87 s
[16:44:03] sass started ...
[16:44:05] sass finished in 1.80 s
[16:44:05] postprocess started ...
[16:44:05] postprocess finished in 25 ms
[16:44:05] lint started ...
[16:44:05] build dev finished in 21.30 s
[16:44:09] lint finished in 3.33 s
ANDROID_HOME=C:\Users\stpng\AppData\Local\Android\sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121

FAILURE: Build failed with an exception.

What went wrong:
java.io.IOException: Invalid argument

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

Error: cmd: Command failed with exit code 1

Ionic info

ordova CLI: 7.0.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.2
Xcode version: Not installed


Android 7.1.1
android sdk platform 25

Ionic flatform list:

Installed platforms:
  android 6.3.0-dev
Available platforms:
  blackberry10 ~3.8.0 (deprecated)
  browser ~4.1.0
  webos ~3.7.0
  windows ~5.0.0


#2

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

Also post the output of ionic platform list please.


#3

Thanks, i create app with ionic can run in web but can’t build android


#4

This seems to be a beta, dev version. You should probably remove your Android platform and add the default one to see if this fixes your problem.


#5

Thanks,I run agian with android 6.2.2 but can’t build


#6

What is the exact command you are calling to build?
Does your Android SDK and JDK really live where it says in the error message?
How did you instal the Android SDK?[quote=“namhd, post:1, topic:89093”]
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[/quote]

Did any of this work?


#7

i use command ionic build android calling to build, use android studio install android sdk
i added JAVA_HOME, ANDROID_HOME to environment


#8

Yes, but are they correct?

One thing sometimes causes problem are long paths and permissions. Maybe reinstall your SDK in another location, like C:\Android.


#9
ANDROID_HOME=C:\Users\stpng\AppData\Local\Android\sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121

i test app in android studio