最近我尝试着导入从谷歌的开发者网站上下载的Android游戏样本。在将它们导入Android Studio后,我得到了以下错误:
错误:未找到SDK位置。使用sdk定义位置。Dir在本地。属性文件或ANDROID_HOME环境变量。
这是什么?我想从Android Studio运行示例程序。
最近我尝试着导入从谷歌的开发者网站上下载的Android游戏样本。在将它们导入Android Studio后,我得到了以下错误:
错误:未找到SDK位置。使用sdk定义位置。Dir在本地。属性文件或ANDROID_HOME环境变量。
这是什么?我想从Android Studio运行示例程序。
当前回答
在我的情况下,我有错误的sdk位置没有找到
我做了什么: 我从git转到了克隆项目 打开项目目录 打开项目内部的app目录 复制本地文件。属性文件 然后粘贴到项目目录中 然后就成功了
其他回答
为我找到了工作解决方案。不添加本地。设置ANDROID_HOME变量。似乎是Android Studio和Intellij IDEA的bug。 你只需要要求IDE“重置”路径到Android SDK。 “SDK Location not found”在Android Studio中,尽管环境变量设置正确
我通过在windows中创建ANDROID_HOME环境变量解决了这个问题。
ANDROID_HOME=C:\Users\<user_name>\AppData\Local\Android\sdk
重新启动Android Studio,它应该构建项目!
创建本地用户。Properties文件中包含以下内容
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Oct 24 17:40:53 CEST 2017
sdk.dir=/Users/****/Library/Android/sdk
任何利用詹金斯的人,都能派上用场
你需要定义一个全局变量ANDROID_HOME和android sdk的路径值。
对于mac,则为/Users/YOUR_USER_NAME/Library/Android/sdk
Mac/Linux用户
你需要将ANDROID_HOME添加到你的路径中,将以下文件添加到你的.bashrc || .zshrc || .profile文件中
# change $HOME to the path where you installed android Sdk
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
然后运行
$ source ~/.bashrc || .zshrc || .profile
bash_profile或bashrc?
.bashrc和.bash_profile的区别