最近我尝试着导入从谷歌的开发者网站上下载的Android游戏样本。在将它们导入Android Studio后,我得到了以下错误:
错误:未找到SDK位置。使用sdk定义位置。Dir在本地。属性文件或ANDROID_HOME环境变量。
这是什么?我想从Android Studio运行示例程序。
最近我尝试着导入从谷歌的开发者网站上下载的Android游戏样本。在将它们导入Android Studio后,我得到了以下错误:
错误:未找到SDK位置。使用sdk定义位置。Dir在本地。属性文件或ANDROID_HOME环境变量。
这是什么?我想从Android Studio运行示例程序。
当前回答
以下步骤:
在android文件夹下创建一个名为local.properties的文件 在“local”文件中添加这一行。属性” sdk.dir = /用户/ bijendrasingh /图书馆/ Android sdk
在这里添加你的android sdk路径。
其他回答
进入android文件夹并创建本地。属性文件,并粘贴您的SDK路径
创建本地用户。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
我遇到的问题是地方性的。属性被提交到git存储库,即使它明确地说不这样做##这个文件必须*不*检入版本控制系统,。
为了在MacOS上修复这个问题,我只是去了文件>项目结构…并自动修复了这个问题。
为了修复git中的问题,我在项目根目录中执行了以下命令:
echo -e "\nlocal.properties" >> .gitignore
git add .gitignore
git rm local.properties --cached
git commit -m "Removed local.properties from the git"
如果你正在使用Flutter,你显然会尝试从Androidmainfest.xml更改名称,只是不要更改回旧名称,一些包会在pub.dev中帮助你
如果您正在尝试运行谷歌android示例代码,请尝试导入整个存储库,而不是单个示例。
下面是instructions.html,包含在谷歌日历API示例代码中。
导入calendar-android-sample项目 选择“Import Project…”或File > Import Project… 选择[someDirectory] / google-api-java-client-samples /构建。它和 单击OK。 注意:如果你试图导入[someDirectory]/google-api-java-client-samples/calendar-android-sample/build.gradle,它将不起作用 选择[someDirectory]/gradle-2.2.1的“Use local gradle distribution”和“gradle home”,单击“OK”。