错误:Android Pre Dex:未指定 Android SDK

2022-01-12 00:00:00 intellij-idea android java libgdx

我已经从网站下载了 gdx-setup.jar 并运行它:

I have downloaded gdx-setup.jar from website and I run it as:

java -jar gdx-setup.jar

我选择我想要的选项并为 idea (libgdx 1.6.2) 生成项目.当我单击生成按钮时,该工具不会向我抛出任何错误.

I select the options that I want and generate project for idea (libgdx 1.6.2). When I click in generate button, the tool doesn't throw me any error.

当我运行 idea 14.1.3 时,我转到 File > Open... 并选择生成的 ipr 文件.

When I run idea 14.1.3 I go to File > Open... and select the ipr file generated.

当我尝试运行桌面启动器时,idea 抛出下一个错误:

When I try to run desktop launcher, idea throw me the next error:

Error:Android Pre Dex: [android] Android SDK is not specified

我尝试过使用不同的构建工具和 android API(当我从 gdx-setup.jar 按下生成按钮时,它们中的大多数都会向我发出警告).我正在使用构建工具 20.0.0 和 API 20,并且使用此配置 gdx-setup.jar 不会向我发出警告.

I have tried with different build tools and API of android (most of them throw me warnings when I pressed generate button from gdx-setup.jar). I am using Build tools 20.0.0 and API 20 and with this configuration gdx-setup.jar doesn't throw me warnings.

我检查了一般项目的 local.properties:sdk.dir=/home/XXXX/Escritorio/android-sdk-linux-libgdx/这是正确的我检查 File > project structure... > SDK's > Android SDK 也是正确的:/home/XXXX/Escritorio/android-sdk-linux-libgdx

I check local.properties of general project: sdk.dir=/home/XXXX/Escritorio/android-sdk-linux-libgdx/ it is right I check File > project structure... > SDK's > Android SDK and it is also right: /home/XXXX/Escritorio/android-sdk-linux-libgdx

有什么建议吗?

谢谢.

推荐答案

进入 Project Structure,选择 Platform Settings -> SDKs(左侧面板),然后通过选择 + 添加您的 Android SDK.然后在 Project Settings -> Module 中,选择 android 模块,然后选择你刚刚添加的 android SDK.

Go in Project Structure, select Platform Settings -> SDKs (left panel) then add your Android SDK by selecting the +. Then in Project Settings -> Module , choose the android module, and choose the android SDK that you just added.

相关文章