I am trying to add multiple environment paths in OSX for Grails and Android.
Here is what my .bash_profile looks like
export GRAILS_HOME=/Users/jon/Downloads/grails-2.4.0
export PATH=$PATH:$GRAILS_HOME/bin
export PATH = ${PATH}:/Users/jon/Library/Android/sdk/tools
export PATH = ${PATH}:/Users/jon/Library/Android/sdk/platform-tools
echo path shows this output:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/jon/Downloads/grails-2.4.0/bin
Android doesn't seem to get added?
Remove space around the = sign and remove {} arount the PATH variable and change those lines like:
export PATH=$PATH:/Users/jon/Library/Android/sdk/tools
export PATH=$PATH:/Users/jon/Library/Android/sdk/platform-tools
Related
I am trying to work with the native native for a school project, but when executing the following command in cmd: emulator -version he returned this error to me:
[4640]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at ..\emulator\lib64\qt\lib
Could not launch 'C:\Users\gusta..\emulator\qemu\windows-x86_64\qemu-system-i386.exe': No such file or directory
already changed the path in several ways and I think the problem is not this so if someone can help me grateful
There are two emulator executables in the sdk (as of now):
sdk/tools/emulator
sdk/emulator/emulator
The emulator executable has to be added in the PATH variable, in a way so that
sdk/emulator/emulator comes before sdk/tools/emulator
Do this to solve the error:
Edit the system environment variables
Make sure you have set user variable for ANDROID_HOME
Remove any variable /path/to/android-sdk/tools from user and system environment variable.
Save and exit
To resolve this error:
Your system variables should look like below:
“C:\Users\username\AppData\Local\Android\Sdk” -ANDROID_HOME
“C:\Users\username\AppData\Local\Android\Sdk\tools\bin” -PATH
“C:\Users\username\AppData\Local\Android\Sdk\platform-tools” -PATH
“C:\Users\username\AppData\Local\Android\Sdk\emulator” - PATH
“C:\Users\username\AppData\Local\Android\Sdk\tools" -PATH
This worked for me.
Based on the answer of IronBlossom.
On mac these are the important environment variables that need to be adjusted.
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
Make sure that emulator comes before tools
i've been using .bashrc (happily) for a long time, but when i tried to add
export PATH="/Users/sam/bin/android-sdk-macosx/platform-tools/" to my path, it wouldn't work... i figured i'd add it to a .bash_profile file, but whenever i run my terminal with .bash_profile, no commands work not ls and none of the commands i put in my .bash_profile path.
i would continue to use .bashrc, but another script (one that i shouldn't edit) uses adb, and i can't get .bashrc to see it for some reason.. (adb is in /Users/sam/bin/android-sdk-macosx/platform-tools/
what should i do?
You have to add the /Users/.../ path to your already existing $PATH
export PATH="${PATH}:/Users/sam/bin/android-sdk-macosx/platform-tools/"
Your command says the $PATH variable will only be 1 "folder" /Users/.... But $PATH is in fact already defined and used. So you have to concatenate the new "folder" to the list of folders in $PATH. If you do echo $PATH you will see this list.
If you want to add more than 1 path, you can still do that in one expression:
export PATH="${PATH}:/Users/sam/bin/android-sdk-macosx/platform-tools/:/Users/sam/bin/:/a/third/addition/"
It seems like you are completely overriding the value of PATH. By default PATH contains references to the binary files, which includes the commands. As you are forcing the value of PATH without preserving the current value your terminal is not finding any other than
"/Users/sam/bin/android-sdk-macosx/platform-tools/"
When modifying the path variable it's recommended to do it in the next way - at least you are sure that the forced value won't break the shell:
PATH=$PATH:New_Reference # Colon is the separator of the values
export PATH
I have set
export PATH=$PATH:/home/user/android-sdk-linux/platform-tools
and execute the above line in command line and later if I type echo $PATH, I could see the path added. But after restarting the system I couldn't see it any more. But putting the system to sleep and then starting again, I could still see it. How to resolve the issue?
Adding it using export on command line would just set it for the current session.To set it permanently you need to add it to .bashrc or /etc/profile.
Your question is similar to:
How to permanently export a variable in Linux?
I want to code Python 3 on my Android device. So I went through Lanky Cyril's blog post on using the Terminal IDE to put all that I needed to do code on an Android terminal. For Python 2.X that is installed on the blog, it works like a charm.
So I installed Python 3 using the same instructions. This is what I get when I try to start Python 3:
terminal++:~$ ~/python3
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
Segmentation fault
I made sure:
export PYTHONHOME=/data/data/com.googlecode.python3forandroid/files/python3
export PYTHONPATH=${PYTHONHOME}/lib/python3.2/lib-dynload
I also checked on why python 3 is not loading on StackOverflow.
So the problem could be the python build. Has anyone worked around this?
I worked out the solution by going to the Python-for-Android (Py4A) home and found the script that allows Python3 to run as a "Stand alone" on Android.
There are 3 ways to do this:
I created the "standalone.sh" script, saved it at "HOME"(export HOME=/data/data/com.spartacusrex.spartacuside/files),
changed its mode to executable, called it and python appeared.
I opened the ~/.bashrc and pasted copied in the code:
export EXTERNAL_STORAGE=/mnt/sdcard/com.googlecode.python3forandroid
export PY34A=/data/data/com.googlecode.python3forandroid/files/python3
export PY4A_EXTRAS=$EXTERNAL_STORAGE/extras
PYTHONPATH=$EXTERNAL_STORAGE/extras/python3
PYTHONPATH=${PYTHONPATH}:$PY34A/lib/python3.2/lib-dynload
export PYTHONPATH
export TEMP=$EXTERNAL_STORAGE/extras/python3/tmp
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=$PY34A
export LD_LIBRARY_PATH=$PY34A/lib
$PYTHONHOME/bin/python3 "$#"
Note that this means every time you launch Terminal IDE, you will automatically load Python and find yourself at the Python prompt.
To launch Python the normal way, like shown by Lanky Cyril, paste the following code in the .bashrc:
export EXTERNAL_STORAGE=/mnt/sdcard/com.googlecode.python3forandroid
export PY34A=/data/data/com.googlecode.python3forandroid/files/python3
export PY4A_EXTRAS=$EXTERNAL_STORAGE/extras
PYTHONPATH=$EXTERNAL_STORAGE/extras/python3
PYTHONPATH=${PYTHONPATH}:$PY34A/lib/python3.2/lib-dynload
export PYTHONPATH
export TEMP=$EXTERNAL_STORAGE/extras/python3/tmp
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=$PY34A
export LD_LIBRARY_PATH=$PY34A/lib
You will notice that the last line in the second solution has been taken out and put in an executable file "~/python". Here is the code:
#!/system/bin/sh
/data/data/com.googlecode.python3forandroid/files/python3/bin/python3 "$#"
I used the second one so that when I launch Terminal IDE, I get my Python prompt instantly. I installed the third solution so that, should I leave the Python prompt, I have a way to get back in the same terminal session.
export PATH=${/home/mohit/}:<android-sdk-linux_86>/tools
this is what i am using..
error:--
bash: PATH=${/home/mohit/}:: bad substitution
this is the path of sdk
mohit#mohit-laptop:~/android-sdk-linux_86$ pwd
/home/mohit/android-sdk-linux_86
Typically you will use
export PATH=${PATH}:<added path here>
try that, to append to your $PATH variable, or just remove the ${} and set it directly, if you wish to replace it. Also keep in mind, this change is not permanent unless you add this to your .bashrc or .bash_profile or equivalent scripts. You can reload them with the
source .bash_profile
command without having to re-login.
The problem is that ${/home/mohit/} is actually treating /home/mohit/ as a variable and attempting to dereference it. My guess is that what you really wanted to do was:
export PATH="$PATH":"$HOME/android-sdk-linux_86/tools"
You can edit your /etc/profile to add the path you need.
Like this:
JAVA_HOME=/opt/jdk1.6.0_30
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JAVA_HOME
export CLASSPATH
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
It is global.
You can maintain a script file under /etc/profile.d/ and we can use it as global