如何为Android应用程序设置IntelliJ IDEA ?


当前回答

以防有人迷路。无论是新的应用程序或现有的去文件->项目结构。然后在左边窗格的项目设置中选择Java SDK的项目,并选择Android SDK的模块。

其他回答

你只需要从http://developer.android.com/sdk/installing/studio.html#Updating安装Android开发工具包

下载和安装Java JDK(选择Java平台)

在windows系统设置https://confluence.atlassian.com/display/DOC/Setting+the+JAVA_HOME+Variable+in+Windows中定义环境变量

瞧!你是Donezo !

我有一些问题,这没有解决在OSX上设置这个环境。这与我维护的解决方案有关,对一些谷歌api有额外的依赖。仅仅下载并安装第一个响应中列出的项目是不够的。

你必须下载这些。

Run Terminal Navigate to the android/sdk directory Type "android" You will get a gui. Check the "Tools" directory and the latest Android API (at this time, it's 4.3 (API 18)). Click "Install xx packages" and go watch an episode of Breaking Bad or something. It'll take a while. Go back to IntelliJ and open the "Project Structure..." dialog (Cmd+;). In the left panel of the dialog, under "Project Settings," select Project. In the right panel, under "Project SDK," click "New..." > Android SDK and navigate to your android/sdk directory. Choose this and you will be presented with a dialog with which you can add the "Google APIs" build target. This is what I needed. You may need to do this more than once if you have multiple version targets. Now, under the left pane "Modules," with your project selected in the center pane, select the appropriate module under the "Dependencies" tab in the right pane.

以防有人迷路。无论是新的应用程序或现有的去文件->项目结构。然后在左边窗格的项目设置中选择Java SDK的项目,并选择Android SDK的模块。

一旦我遵循了所有这些步骤,我开始在所有android类调用中收到错误消息,比如:

我旋转包括android.jar在sdk平台设置:

另一种识别正确SDK的方法是安装Android Studio,创建一个新项目,进入项目结构,SDK位置,找到SDK安装的位置。

我发现在mac上使用默认的安装过程,SDK主文件夹在/Users/'yourUser'/Library/Android/ SDK文件夹中。确保您已启用Mac以查看Library文件夹。