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
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 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
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'm trying to do what the question says -- using a Cygwin shell. I've set it up according to 2 essentially equivalent tutorials I've Googled but yet I can not get the shell/make process to work properly. Unix/Cygwin skills lack, obviously.
So, my Cygwin is installed to it's default location and I've got the Android SDK and NDK set up right as well (normal Java apps work fine building/debugging from Eclipse).
This is how my modified Cygwin.bat looks:
#echo off
set IS_UNIX=
set DEV_ROOT=c:/PROGRA~1/Android/android-ndk-r6/samples/san-angeles
set JAVA_HOME=c:/PROGRA~1/Java/jdk1.6.0_26
set CLASSPATH=c:/PROGRA~1/Android/android-ndk-r6/samples/san-angeles/obj
set PATH=c:/PROGRA~1/Android/android-sdk/tools;c:/PROGRA~1/Android/android-ndk-r6
set ANDROID_NDK_ROOT=c:/PROGRA~1/Android/android-ndk-r6
set NDK_PROJECT_PATH=c:/PROGRA~1/Android/android-ndk-r6/samples/san-angeles
C:
chdir C:\cygwin\bin
bash --login -i
These paths are correct. When I change path to the NDK root and type ./ndk-build, this is the result:
nova#edwmini ~
$ cd c:/progra~1/android/android-ndk-r6
nova#edwmini /cygdrive/c/progra~1/android/android-ndk-r6
$ ./ndk-build
/cygdrive/c/progra~1/android/android-ndk-r6/build/core/build-binary.mk:37: *** t
arget pattern contains no `%'. Stop.
nova#edwmini /cygdrive/c/progra~1/android/android-ndk-r6
$
A kick in my ass in the right direction would be greatly appreciated.
I've fixed the problem using the comments.
Firstly I had to go to the project path in order to build, secondly it helped when I replaced all the DOS paths for posix/Cygwin paths! Here is the new batch file:
#echo off
set DEV_ROOT=/cygdrive/c/PROGRA~1/Android/android-ndk-r6/samples/hello-gl2
set IS_UNIX=
set JAVA_HOME=/cygdrive/c/PROGRA~1/Java/jdk1.6.0_26
set ANDROID_NDK_ROOT=/cygdrive/c/PROGRA~1/Android/android-ndk-r6
set PATH=/cygdrive/c/PROGRA~1/Android/android-sdk/tools:%ANDROID_NDK_ROOT%:$PATH
set CLASSPATH=%DEV_ROOT%/obj
set NDK_PROJECT_PATH=%DEV_ROOT%
C:
chdir C:\cygwin\bin
bash --login -i
The sample has changed but you'll get it. Also, #startup, do: cd $DEV_ROOT
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