I am new in developing native app using Salesforce SDK. I tried to create android project from command line using forcedroid tool but there is problem in setting environment variable named ANDROID_HOME.
我是使用Salesforce SDK开发本机应用程序的新手。我尝试使用forcedroid工具从命令行创建android项目,但是在设置名为ANDROID_HOME的环境变量时存在问题。
But i don't know how to set this variable.
但我不知道如何设置这个变量。
I am attaching screenshot to describe my problem correctly.
我附上截图来正确描述我的问题。
4 个解决方案
#1
61
Open the terminal and type :
打开终端并输入:
export ANDROID_HOME=/Applications/ADT/sdk
Add this to the PATH environment variable
将其添加到PATH环境变量中
export PATH=$PATH:$ANDROID_HOME/bin
If the terminal doesn't locate the added path(s) from the .bash_profile, please run this command
如果终端没有找到.bash_profile中添加的路径,请运行此命令
source ~/.bash_profile
source~ / .bash_profile
Hope it works to you!
希望它对你有用!
#2
96
To make it permanent on your system and the variable keep working after close the terminal, ou after a restart use:
为了使它在您的系统上永久化并且变量在关闭终端后继续工作,请在重新启动后使用:
nano ~/.bash_profile
Add lines:
添加行:
export ANDROID_HOME=/YOUR_PATH_TO/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
Reopen terminal and check if it worked:
重新打开终端并检查它是否有效:
source ~/.bash_profile
echo $ANDROID_HOME
#3
21
The above answer is correct. Works really well. There is also quick way to do this.
以上答案是正确的。工作得很好。还有快速的方法来做到这一点。
- Open command prompt
- 打开命令提示符
-
Type - echo export "ANDROID_HOME=/Users/yourName/Library/Android/sdk" >> ~/.bash_profile
类型 - 回显导出“ANDROID_HOME = / Users / yourName / Library / Android / sdk”>>〜/ .bash_profile
Thats's it.
多数民众赞成吧。
-
Close your terminal.
关闭你的终端。
-
Open it again.
再打开它。
-
Type - echo $ANDROID_HOME to check if the home is set.
键入 - echo $ ANDROID_HOME以检查是否已设置主页。
#4
-1
source ~/.bash_profile
export ANDROID_HOME=/YOUR_PATH_TO/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
#1
61
Open the terminal and type :
打开终端并输入:
export ANDROID_HOME=/Applications/ADT/sdk
Add this to the PATH environment variable
将其添加到PATH环境变量中
export PATH=$PATH:$ANDROID_HOME/bin
If the terminal doesn't locate the added path(s) from the .bash_profile, please run this command
如果终端没有找到.bash_profile中添加的路径,请运行此命令
source ~/.bash_profile
source~ / .bash_profile
Hope it works to you!
希望它对你有用!
#2
96
To make it permanent on your system and the variable keep working after close the terminal, ou after a restart use:
为了使它在您的系统上永久化并且变量在关闭终端后继续工作,请在重新启动后使用:
nano ~/.bash_profile
Add lines:
添加行:
export ANDROID_HOME=/YOUR_PATH_TO/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
Reopen terminal and check if it worked:
重新打开终端并检查它是否有效:
source ~/.bash_profile
echo $ANDROID_HOME
#3
21
The above answer is correct. Works really well. There is also quick way to do this.
以上答案是正确的。工作得很好。还有快速的方法来做到这一点。
- Open command prompt
- 打开命令提示符
-
Type - echo export "ANDROID_HOME=/Users/yourName/Library/Android/sdk" >> ~/.bash_profile
类型 - 回显导出“ANDROID_HOME = / Users / yourName / Library / Android / sdk”>>〜/ .bash_profile
Thats's it.
多数民众赞成吧。
-
Close your terminal.
关闭你的终端。
-
Open it again.
再打开它。
-
Type - echo $ANDROID_HOME to check if the home is set.
键入 - echo $ ANDROID_HOME以检查是否已设置主页。
#4
-1
source ~/.bash_profile
export ANDROID_HOME=/YOUR_PATH_TO/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH