Note: directory can't be found in android sdk error due to conflicting export environment

I’ve wasted a few hours when I first started using zsh about a year ago, but didn’t remember the fix and now wasted a couple more today.

It’s mostly a dumb user error, but it’s one where the solution (or location of problem) didn’t come to mind quickly for me. So I’m posting this up here as a searchable reminder note.

If you’re using a login shell other than bash and you run a bash script it should pull in the current environment exports and everything should run fine. ./setup.py should store your entered SDK/NDK/ANT paths in your current shell resource file (e.g. .zshrc). All is well.

However, if you happen to for some reason have conflicting values in your .bashrc/.bash_profile you’ll get errors. For example, if you were using bash way back when and the android SDK/NDK were in your ~/dev/lib directory, but recently you started using Android Studio and removed the old dir and downloaded sdk/ndk into the studio’s default ~/Library/Android.

I’m not sure if there’s a more verbose flag when running cocos command. That would have solved this issue for me since I could have seen the export values printed out and noticed they’re different from where the sdk/ndk is located now.