导入gradle项目,android报错

2022-01-12 00:00:00 git android gradle eclipse libgdx

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

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.

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

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:

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

我已经用

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.

该项目最初是在我的 Windows 计算机上创建的(一切正常),并使用 git 将它也安装在我的 mac 上用于 ios 的东西.

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.

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

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.

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

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

PS:目录:

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

--SpeedRun-核心

--SpeedRun-core

推荐答案

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

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

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

相关文章