git 导入gradle项目,android报错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23983221/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:04:31  来源:igfitidea点击:

Importing gradle project, android error

androideclipsegitgradlelibgdx

提问by Alon Zilberman

I am trying to import a libgdx project (desktop, ios and android) to eclipse on my mac, which I have in my local git repository.

我正在尝试将 libgdx 项目(桌面、ios 和 android)导入到我的本地 git 存储库中的 mac 上的 eclipse。

When I try to import my project to eclipse ( Import >> Gradle >> Gradle Project, and then add my Root Folder for the whole libgdx project), I try to "Build Model", but then I get an error saying:

当我尝试将我的项目导入到 Eclipse(导入 >> Gradle >> Gradle 项目,然后为整个 libgdx 项目添加我的根文件夹)时,我尝试“构建模型”,但随后出现错误消息:

"SDK location not Found. Define location with sdk.dir in the local.properties file or with and ANDROID_HOME environment variable"

I have already set my ANDROID_HOME with

我已经设置了我的 ANDROID_HOME

export ANDROID_HOME=/Development/Tools/android-sdk-mac
export PATH=$PATH:$ANDROID_HOME/bin

but I still get the same error and it doesn't work.

但我仍然遇到同样的错误,而且它不起作用。

The project was originally created on my windows computer (where everything is working fine) and used git to also have it on my mac for ios stuff.

该项目最初是在我的 Windows 计算机上创建的(一切正常),并使用 git 也将它放在我的 mac 上用于 ios 内容。

I have also tried importing it as a local git repo ( Import >> Git >> Projects from Git >> Existing local repository, added the path to the project). When I then choose the wizard for project import as "Import existing projects" it finds none. And when I import as "Use the New Project wizard" and "Import as general project" it doesn't work and I can't run my projects (desktop, ios and android) and sometimes I don't even get my project files up in eclipse.

我也尝试将它作为本地 git 存储库导入(导入 >> Git >> 来自 Git 的项目 >> 现有本地存储库,添加了项目的路径)。当我将项目导入向导选择为“导入现有项目”时,它没有找到。当我导入为“使用新项目向导”和“作为一般项目导入”时,它不起作用,我无法运行我的项目(桌面、ios 和 android),有时我什至没有得到我的项目文件在日食。

What am I doing wrong and how can I fix this?

我做错了什么,我该如何解决?

PS: Directory:

PS:目录:

-SpeedRun
--SpeedRun-android
--SpeedRun-desktop
--SpeedRun-ios

--SpeedRun-core

--SpeedRun-核心

回答by Alon Zilberman

Add file local.propertiesto your project root folder. There you should write location of your Android SDK like this:

将文件添加local.properties到您的项目根文件夹。在那里你应该像这样写你的 Android SDK 的位置:

sdk.dir=/Users/ab/Android/adt-bundle-mac-x86_64-20130917/sdk