Java intelliJ IDEA 13 错误:请选择Android SDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21070268/
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
intelliJ IDEA 13 error: please select Android SDK
提问by daiyue
I have installed Android SDK 22.3
and JDK 1.7 update 21
on Win7 x64
. Now I created an empty android application project using intelliJ 13.0.1
(also use Emulator as target device) and tried to build the project, but encountered the 'Error: Please select Android SDK'
.
我已经安装Android SDK 22.3
并JDK 1.7 update 21
在Win7 x64
. 现在我使用intelliJ 13.0.1
(也使用模拟器作为目标设备)创建了一个空的 android 应用程序项目并尝试构建该项目,但遇到了'Error: Please select Android SDK'
.
So I choose Emulator
as the Target Device
, but I could not select my AVD, as there is a Error: Cannot find any configured Android SDK
.
所以我选择Emulator
作为Target Device
,但我无法选择我的 AVD,因为有一个Error: Cannot find any configured Android SDK
.
In the Project Structure, it clearly shows 'Android 4.4.2 platform' as Project SDK. So I am totally confused, don't know how to resolve the issue.
在项目结构中,它清楚地将“Android 4.4.2 平台”显示为项目 SDK。所以我很困惑,不知道如何解决这个问题。
ps. I was upgrading intelliJ 12.1.2
to intelliJ 13.0.1
, and all the settings were automatically inherited from 12.1.2 when launching 13.0.1, but it seems not all the settings were exactly copied over to 13.0.1, which is unexpected.
附:我正在升级intelliJ 12.1.2
到intelliJ 13.0.1
,并且在启动 13.0.1 时所有设置都自动从 12.1.2 继承,但似乎并非所有设置都完全复制到 13.0.1,这出乎意料。
cheers
干杯
回答by Giorgos Neokleous
check if you have installed all the add-ons that are necessary. Also I recommend you to use a real android phone for debugging. It's better, It's real and faster.
检查您是否已安装所有必需的附加组件。此外,我建议您使用真正的 android 手机进行调试。更好,更真实,更快。
回答by Yoo Matsuo
I had the same problem as you did when I also updated from intellij Idea 12 to 13. In my situation, my Android SDK's Build target wasn't recognized properly, it said something like "Not set" in red instead Android 2.2. Even though I chose Android 2.2 and clicked apply and OK, it showed the "Not set" message again when I reopened the project structure dialog.
当我从 intellij Idea 12 更新到 13 时,我遇到了和你一样的问题。在我的情况下,我的 Android SDK 的构建目标没有被正确识别,它用红色表示“未设置”,而不是 Android 2.2。即使我选择了 Android 2.2 并单击应用和确定,当我重新打开项目结构对话框时,它再次显示“未设置”消息。
Then I chose an other version, Android 4.0 this time, clicked apply, then chose Android 2.2 again, clicked apply. This worked for me.
然后我选择了另一个版本,这次是Android 4.0,点击应用,然后再次选择Android 2.2,点击应用。这对我有用。
回答by Mikel Pascual
Seems a lot like IDEA can't find the Android SDK.
看起来很像IDEA找不到Android SDK。
Have restarted the computer after using the Android SDK Installer?
使用 Android SDK 安装程序后是否重新启动了计算机?
After that, have you started the SDK Manager to install the Android 4.2.2 SDK?
之后,您是否启动了 SDK Manager 来安装 Android 4.2.2 SDK?
Can you check the Android_SDK_HOME environment variable?
你能检查一下 Android_SDK_HOME 环境变量吗?
Take into account that the Android SDK Installer just installs a Manager. After that, you haveto install an SDK (or several).
考虑到 Android SDK 安装程序只安装一个管理器。之后,您必须安装一个(或多个)SDK。
Also, when you see 'Android 4.4.2 platform' in the Project Structure, that means that the project will ask for that SDK. It doesn't mean that the SDK has been installed.
此外,当您在项目结构中看到“Android 4.4.2 平台”时,这意味着该项目将要求该 SDK。这并不意味着已经安装了 SDK。
回答by Ali
Delete all android SDKs from Intellij and add them again.
从 Intellij 中删除所有 android SDK 并再次添加它们。
To do this open project structure, in SDK pane, delete all android SDK, click OK. open project structure and add them again.
为此打开项目结构,在 SDK 窗格中,删除所有 android SDK,单击 OK。打开项目结构并再次添加它们。
回答by Hesam
I faced the problem in IntelliJ Idea 14 actually. My project was working fine on Android Studio. I decided to continue development on IntelliJ idea. After import of project, I wasn't successful to RUN it and I got similar error message in Edit Configuration box. Based on What @Ali said, I deleted all my SDKs and reinstalled them again but didn't work.
我实际上在 IntelliJ Idea 14 中遇到了这个问题。我的项目在 Android Studio 上运行良好。我决定继续开发 IntelliJ 的想法。导入项目后,我无法成功运行它,并且在“编辑配置”框中收到类似的错误消息。根据@Ali 所说的,我删除了所有 SDK 并重新安装了它们,但没有奏效。
I opened "Project Structure">"Platform Settings">SDKs. I found "Build target" of "Android API 21 Platform" is not set. By set it to one of my latest SDK the problem fixed and I could run project without problem.
我打开了“项目结构”>“平台设置”>“SDK”。我发现未设置“Android API 21 平台”的“构建目标”。通过将它设置为我最新的 SDK 之一,问题得到解决,我可以毫无问题地运行项目。
回答by Christian Wilkie
I encountered this error after installing Intellij IDEA Ultimate 14.1 and opening an existing Android project I had created using Android Studio. It turns out I just had to add the Android SDK to my list of SDKs and fix the project/module SDK settings. This is how I did it:
在安装 Intellij IDEA Ultimate 14.1 并打开我使用 Android Studio 创建的现有 Android 项目后,我遇到了这个错误。结果证明我只需要将 Android SDK 添加到我的 SDK 列表中并修复项目/模块 SDK 设置。我是这样做的:
Go to File -> Project Structure
. Click on the Project tab under Project Settings. Under Project SDK click on New -> Android SDK
.
去File -> Project Structure
。单击项目设置下的项目选项卡。在 Project SDK 下,单击New -> Android SDK
。
Now select the existing directory for your Android SDK. In my case it was in this folder:
现在为您的 Android SDK 选择现有目录。在我的情况下,它在这个文件夹中:
C:\Users\<windows username>\AppData\Local\Android\android-sdk
C:\Users\<windows username>\AppData\Local\Android\android-sdk
Click Ok. A menu pops up asking you to set the Java SDK + Build target. You can either change these or leave it as its defaults and hit Ok. You should now see "Android API XX Platform" in the Project SDK dropdown. Click apply on the bottom. Then go to the Modules tab under Project Settings and click on the folders in the modules listing.
单击确定。会弹出一个菜单,要求您设置 Java SDK + Build 目标。您可以更改这些或将其保留为默认值,然后单击“确定”。您现在应该在项目 SDK 下拉列表中看到“Android API XX 平台”。点击底部的应用。然后转到“项目设置”下的“模块”选项卡,然后单击模块列表中的文件夹。
For each folder go to the dependencies tab and change the Module SDK to the new Android SDK and click apply. Then click Ok to close the Project Structure dialog.
对于每个文件夹,转到依赖项选项卡并将模块 SDK 更改为新的 Android SDK,然后单击应用。然后单击“确定”关闭“项目结构”对话框。
After doing the above, my project was fixed.
完成上述操作后,我的项目已修复。
回答by maimArt
I had a similar problem. I had to add the same android sdk that i used before again and it worked.
我有一个类似的问题。我不得不再次添加我之前使用过的相同 android sdk 并且它起作用了。
回答by rocciax
My Problem:"please select Android SDK", But everything is okey :( -> I think one of IntelliJ file was crashed (after blue screen of death)
我的问题:“请选择 Android SDK”,但一切正常 :( -> 我认为 IntelliJ 文件之一已崩溃(蓝屏死机后)
My resolution:
我的决心:
File -> Settings -> Android SDK -> Android SDK Location Edit -> Next, Next (Android SDK is up to date.), Finished
File -> Settings -> Android SDK -> Android SDK Location Edit -> Next, Next (Android SDK is up to date.), Finished
... and crashed file was repaired!
...并修复了崩溃的文件!
回答by Ispas Claudiu
Maybe not so common solution but for me restarting the IDEworked just fine. I use Android Studio 2.2.3.
也许不是那么常见的解决方案,但对我来说,重新启动 IDE工作得很好。我使用 Android Studio 2.2.3。
回答by maXp
Check next lines in you app build.gradle file.
检查 app build.gradle 文件中的下一行。
android {
compileSdkVersion 25 <--- Set exist in local machine sdk version.
buildToolsVersion '25.0.3' <--- Set exist build tools version.
}