Can't build android apk - Error: Cannot read property '1' of null

Hi everyone,

I did install ionic and cordova via npm without errors, then I run these commmands:

ionic start test tabs --> without errors
cd test
ionic serve --> without errors, open a browser and app works great
q --> to quit ionic serve
ionic platform add android --> without errors
ionic build android --> and then, I found these errors:

add to body class: platform-android
ERROR building one of the platforms: TypeError: Cannot read property ‘1’ of null
You may not have the required environment or OS to build this project
Error: Cannot read property ‘1’ of null

I uninstall and re-install android sdk, ionic and cordova, and always the same error.

Any suggestion?

Regards,
Ricardo.

Please post more log, or the output of ionic info

I’m experiencing the same issue here. @rpereyra did you get a solution.

$ ionic info
Your system information:

Cordova CLI: 6.0.0
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS
Node Version: v5.6.0

And my path variables are correct

Have you check that code is correct? Sometimes this cryptic error is caused by angular errors like this: http://www.stephenbero.com/angularjs-read-property-1-null-error

Check your code with jslint and try to build an empty demo app.

Yes, mi code is a clean “ionic start test”. And error raise.

nagarjunbn8, finally I solve this error uninstall and reinstall java sdk.

Good luck!

Based on your query I saw that you have not tried reinstalling JAVA JDK… I reinstalled and it worked. And thanks again for our reply @rpereyra.

I have the same problem. Reinstalling JDK does not solve the problem. How can I found out more about this error? Is there a log somewhere, because all it says is “Error: Cannot read property ‘1’ of null”. There is no more information where this error originates from.

Hi @Jasper7000

I used the link to remove the JDK .


I used this because I was having many versions of JDK like Open JDK(default installed in ubuntu) , Oralce Java 9 and 8 .

I used this link to install oracle JAVA 8

It worked . Hope this helps

Uninstalling open JDK might resolve the problem, however does not given any insight why this happens. There might be an issue with ionic where other people can run into as well.

Hola ricardo. Me podrías pasar los comandos que usaste para solucionar el problema.

Tengo el mismo:
Error: Cannot read property '1' of null