简体   繁体   English

将IntelliJ升级到10.5并且Android构建失败未指定Android SDK

[英]Upgrade IntelliJ to 10.5 and Android build fails Android SDK not specified

I just recently updated my IntelliJ Idea installation on my Mac to 10.5. 我刚刚将Mac上的IntelliJ Idea安装更新到10.5。 I had an Android project that I was working on in 10.0.3 and everything was working great. 我有一个我在10.0.3中工作的Android项目,一切都运行良好。 Now when I try to build the project I am getting an Error: 现在当我尝试构建项目时,我收到一个错误:

Information:Compilation completed with 1 error and 0 warnings
Information:1 error
Information:0 warnings
Error:Android SDK is not specified for module Project_Android

It sounds like IntelliJ doesn't know where the Android SDK is. 听起来IntelliJ不知道Android SDK的位置。

Here is a step by step: 这是一步一步:

  1. From your existing project, go to 'File' -> 'Project Structure' 从现有项目中,转到“文件” - >“项目结构”
  2. Click 'Modules' entry from the 'Project Settings' group (on the left side) 点击“项目设置”组中的“模块”条目(左侧)
  3. Click 'Android' module for your project 点击项目的“Android”模块
  4. Click 'New' where it says 'Android Platform' 点击“新建”,其中显示“Android平台”
  5. Point it to the Android SDK location that you have locally. 将其指向您在本地拥有的Android SDK位置。
  6. Select an API version. 选择API版本。
  7. Click 'Apply' 点击“申请”

That should be it. 那应该是它。 Good luck! 祝好运!

Image added 图片添加 在此输入图像描述

As Neil Traft suggests, you also have to make it default project SDK as well. 正如Neil Traft建议的那样,你也必须将它作为默认项目SDK。 IntelliJ 13.1.3截图

I was very confused by this as well. 我也很困惑。 I was missing the android sdk under platform settings. 我在平台设置下错过了android sdk。 在此输入图像描述

After adding this configuration, it still didn't work until I restarted Intelli-J. 添加此配置后,它仍然无法工作,直到我重新启动Intelli-J。 Very confusing. 很混乱。

Please note that Android SDK configuration has changed in 10.5. 请注意,Android SDK配置在10.5中已更改。 Refer to the blog for details. 有关详细信息, 请参阅博客

I got this same error when creating a new project with LibGDX 1.9.4 with the IntelliJ project option and opening it. 使用IntelliJ项目选项创建一个带有LibGDX 1.9.4的新项目并打开它时,我遇到了同样的错误。 Many of these answers are getting old, so here is confirmation from 2016! 其中许多答案都在变老,所以这是2016年的确认!

The solution that worked for me was to go into the module settings and change to the Android SDK instead of the default Java SDK for the Android module: 对我有用的解决方案是进入模块设置并更改为Android SDK而不是Android模块的默认Java SDK:

  1. Right click on the project and select Open Module Settings. 右键单击项目,然后选择“打开模块设置”。
  2. Select Modules under Project Settings. 选择项目设置下的模块。
  3. Select the Android module. 选择Android模块。
  4. Select the Dependencies tab. 选择“依赖关系”选项卡。
  5. Choose the appropriate Android SDK instead of the Java SDK. 选择适当的Android SDK而不是Java SDK。

    • If the desired Android SDK is not present, go to the SDKs tab under Platform Settings and add the new Android SDK via the '+' button. 如果没有所需的Android SDK,请转到平台设置下的SDK选项卡,然后通过'+'按钮添加新的Android SDK。

I was able to run the project after the Android SDK was set. 设置Android SDK后,我能够运行该项目。 Thanks to @nicholas.hauschild for guidance on this solution! 感谢@ nicholas.hauschild对此解决方案的指导!

解决方案是在模块设置中使用Android SDK设置android模块。 IntelliJ IDEA 2016.2.4 Build #IC-162.2032.8, built on September 9, 2016 JRE: 1.8.0_112-release-b343 x86

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM