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

时间:2023-01-13 22:20:15

How do I set up IntelliJ IDEA for Android applications?

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

7 个解决方案

#1


391  

I've spent a day on trying to put all the pieces together, been in hundreds of sites and tutorials, but they all skip trivial steps.

我花了一天的时间试图把所有的部分放在一起,在数百个站点和教程中,但是他们都跳过了一些琐碎的步骤。

So here's the full guide:

这里有完整的指南:

  1. Download and install Java JDK (Choose the Java platform)
  2. 下载并安装Java JDK(选择Java平台)
  3. Download and install Android SDK (Installer is recommended)
  4. 下载安装Android SDK(推荐安装)
  5. After android SD finishes installing, open SDK Manager under Android SDK Tools (sometimes needs to be opened under admin's privileges)
  6. 安装完成后,在android SDK工具下打开SDK管理器(有时需要在admin的权限下打开)
  7. Choose everything and mark Accept All and install.
  8. 选择一切并标记接受一切并安装。
  9. Download and install IntelliJ IDEA (The community edition is free)
  10. 下载并安装IntelliJ IDEA(社区版是免费的)
  11. Wait for all downloads and installations and stuff to finish.
  12. 等待所有下载、安装和其他东西完成。

New Project:

新项目:

  1. Run IntelliJ
  2. IntelliJ运行
  3. Create a new project (there's a tutorial here)
  4. 创建一个新项目(这里有一个教程)
  5. Enter the name, choose Android type.
  6. 输入名称,选择Android类型。
  7. There's a step missing in the tutorial, when you are asked to choose the JDK (before choosing the SDK) you need to choose the Java JDK you've installed earlier. Should be under C:\Program Files\Java\jdk{version}
  8. 本教程中缺少一个步骤,当您被要求选择JDK(在选择SDK之前)时,您需要选择之前安装的Java JDK。应该在C:\Program Files\Java\ jdk { version }
  9. Choose a New platform ( if there's not one selected ) , the SDK platform is the android platform at C:\Program Files\Android\android-sdk-windows.
  10. 选择一个新平台(如果没有选中),SDK平台android平台在C:\Program Files\Android\ android-sdk-windows。
  11. Choose the android version.
  12. 选择android版本。
  13. Now you can write your program.
  14. 现在可以编写程序了。

Compiling:

编译:

  1. Near the Run button you need to select the drop-down-list, choose Edit Configurations
  2. 在Run按钮附近,您需要选择下拉列表,选择编辑配置
  3. In the Prefer Android Virtual device select the ... button
  4. 在Android虚拟设备中选择…按钮
  5. Click on create, give it a name, press OK.
  6. 点击create,给它一个名字,点击OK。
  7. Double click the new device to choose it.
  8. 双击新设备选择它。
  9. Press OK.
  10. 按下OK。
  11. You're ready to run the program.
  12. 你已经准备好运行这个程序了。

#2


27  

The 5th step in "New Project' has apparently changed slightly since.

“新项目”的第五步显然从那时起有了些许变化。

Where it says android sdk then has the drop down menu that says none, there is no longer a 'new' button.

当它说android sdk有下拉菜单时,它说没有,不再有一个“新的”按钮。

  • 5.)

    5)。

    • a.)click the ... to the right of none.
    • )点击…右边没有。
    • b.)click the + in the top left of new window dialog. (Add new Sdk)
    • b.)单击新建窗口对话框左上角的+。(添加新的Sdk)
    • c.)click android sdk from drop down menu
    • c.)从下拉菜单点击android sdk。
    • d.)select home directory for your android sdk
    • d.)为android sdk选择home目录
    • e.)select java sdk version you want to use
    • e.)选择您想要使用的java sdk版本
    • f.)select android build target.
    • f。)选择android构建目标。
    • g.)hit ok!
    • g。)点击确定!

#3


26  

Once I have followed all these steps, I start to receive error messages in all android classes calls like:

一旦我完成了所有这些步骤,我就开始在所有android类调用中接收错误消息,比如:

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

I revolved that including android.jar in the SDKs Platform Settings:

包括安卓在内,我也参与了。SDKs平台设置中的jar:

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

#4


4  

Just in case someone is lost. For both new application or existing ones go to File->Project Structure. Then in Project settings on the left pane select Project for the Java SDK and select Modules for Android SDK.

以防有人迷路。对于新应用程序或现有应用程序,请转到File->项目结构。然后在左侧面板的项目设置中为Java SDK选择项目,为Android SDK选择模块。

#5


4  

I had some issues that this didn't address in getting this environment set up on OSX. It had to do with the solution that I was maintaining having additional dependencies on some of the Google APIs. It wasn't enough to just download and install the items listed in the first response.

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

You have to download these.

你必须下载这些。

  1. Run Terminal
  2. 运行终端
  3. Navigate to the android/sdk directory
  4. 导航到android/sdk目录。
  5. 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)).
  6. 输入“android”,你会得到一个gui。检查“工具”目录和最新的Android API(此时,它是4.3 (API 18))。
  7. Click "Install xx packages" and go watch an episode of Breaking Bad or something. It'll take a while.
  8. 点击“安装xx包”,观看《绝命毒师》之类的节目。这将需要一段时间。
  9. Go back to IntelliJ and open the "Project Structure..." dialog (Cmd+;).
  10. 回到IntelliJ,打开“项目结构…”对话框(Cmd+;)。
  11. 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.
  12. 在对话框的左面板“项目设置”下,选择项目。在右边的面板中,在“项目SDK”下,单击“New…”> Android SDK,导航到您的Android / SDK目录。选择此选项,您将看到一个对话框,您可以使用该对话框添加“谷歌api”构建目标。这就是我所需要的。如果您有多个版本目标,您可能需要多次执行此操作。
  13. 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.
  14. 现在,在左侧窗格“模块”下,在中心窗格中选择您的项目,在右侧窗格中的“Dependencies”选项卡下选择适当的模块。

#6


3  

Another way to identify the correct SDK is to install Android Studio, create a new project, go to project structure, SDK Location and find where the SDK was installed.

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

I found using the default installation process on a mac that the SDK home folder was in the /Users/'yourUser'/Library/Android/sdk folder. Make sure you have enabled your Mac to view the Library folder.

我发现使用mac上的默认安装过程,SDK主文件夹位于/Users/'yourUser'/Library/Android/ SDK文件夹中。确保你的Mac可以查看库文件夹。

#7


1  

You just need to install Android development kit from http://developer.android.com/sdk/installing/studio.html#Updating

您只需从http://developer.android.com/sdk/installing/studio.html#更新中安装Android开发工具包

and also Download and install Java JDK (Choose the Java platform)

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

define the environment variable in windows System setting https://confluence.atlassian.com/display/DOC/Setting+the+JAVA_HOME+Variable+in+Windows

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

Voila ! You are Donezo !

瞧!你是Donezo !

#1


391  

I've spent a day on trying to put all the pieces together, been in hundreds of sites and tutorials, but they all skip trivial steps.

我花了一天的时间试图把所有的部分放在一起,在数百个站点和教程中,但是他们都跳过了一些琐碎的步骤。

So here's the full guide:

这里有完整的指南:

  1. Download and install Java JDK (Choose the Java platform)
  2. 下载并安装Java JDK(选择Java平台)
  3. Download and install Android SDK (Installer is recommended)
  4. 下载安装Android SDK(推荐安装)
  5. After android SD finishes installing, open SDK Manager under Android SDK Tools (sometimes needs to be opened under admin's privileges)
  6. 安装完成后,在android SDK工具下打开SDK管理器(有时需要在admin的权限下打开)
  7. Choose everything and mark Accept All and install.
  8. 选择一切并标记接受一切并安装。
  9. Download and install IntelliJ IDEA (The community edition is free)
  10. 下载并安装IntelliJ IDEA(社区版是免费的)
  11. Wait for all downloads and installations and stuff to finish.
  12. 等待所有下载、安装和其他东西完成。

New Project:

新项目:

  1. Run IntelliJ
  2. IntelliJ运行
  3. Create a new project (there's a tutorial here)
  4. 创建一个新项目(这里有一个教程)
  5. Enter the name, choose Android type.
  6. 输入名称,选择Android类型。
  7. There's a step missing in the tutorial, when you are asked to choose the JDK (before choosing the SDK) you need to choose the Java JDK you've installed earlier. Should be under C:\Program Files\Java\jdk{version}
  8. 本教程中缺少一个步骤,当您被要求选择JDK(在选择SDK之前)时,您需要选择之前安装的Java JDK。应该在C:\Program Files\Java\ jdk { version }
  9. Choose a New platform ( if there's not one selected ) , the SDK platform is the android platform at C:\Program Files\Android\android-sdk-windows.
  10. 选择一个新平台(如果没有选中),SDK平台android平台在C:\Program Files\Android\ android-sdk-windows。
  11. Choose the android version.
  12. 选择android版本。
  13. Now you can write your program.
  14. 现在可以编写程序了。

Compiling:

编译:

  1. Near the Run button you need to select the drop-down-list, choose Edit Configurations
  2. 在Run按钮附近,您需要选择下拉列表,选择编辑配置
  3. In the Prefer Android Virtual device select the ... button
  4. 在Android虚拟设备中选择…按钮
  5. Click on create, give it a name, press OK.
  6. 点击create,给它一个名字,点击OK。
  7. Double click the new device to choose it.
  8. 双击新设备选择它。
  9. Press OK.
  10. 按下OK。
  11. You're ready to run the program.
  12. 你已经准备好运行这个程序了。

#2


27  

The 5th step in "New Project' has apparently changed slightly since.

“新项目”的第五步显然从那时起有了些许变化。

Where it says android sdk then has the drop down menu that says none, there is no longer a 'new' button.

当它说android sdk有下拉菜单时,它说没有,不再有一个“新的”按钮。

  • 5.)

    5)。

    • a.)click the ... to the right of none.
    • )点击…右边没有。
    • b.)click the + in the top left of new window dialog. (Add new Sdk)
    • b.)单击新建窗口对话框左上角的+。(添加新的Sdk)
    • c.)click android sdk from drop down menu
    • c.)从下拉菜单点击android sdk。
    • d.)select home directory for your android sdk
    • d.)为android sdk选择home目录
    • e.)select java sdk version you want to use
    • e.)选择您想要使用的java sdk版本
    • f.)select android build target.
    • f。)选择android构建目标。
    • g.)hit ok!
    • g。)点击确定!

#3


26  

Once I have followed all these steps, I start to receive error messages in all android classes calls like:

一旦我完成了所有这些步骤,我就开始在所有android类调用中接收错误消息,比如:

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

I revolved that including android.jar in the SDKs Platform Settings:

包括安卓在内,我也参与了。SDKs平台设置中的jar:

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

#4


4  

Just in case someone is lost. For both new application or existing ones go to File->Project Structure. Then in Project settings on the left pane select Project for the Java SDK and select Modules for Android SDK.

以防有人迷路。对于新应用程序或现有应用程序,请转到File->项目结构。然后在左侧面板的项目设置中为Java SDK选择项目,为Android SDK选择模块。

#5


4  

I had some issues that this didn't address in getting this environment set up on OSX. It had to do with the solution that I was maintaining having additional dependencies on some of the Google APIs. It wasn't enough to just download and install the items listed in the first response.

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

You have to download these.

你必须下载这些。

  1. Run Terminal
  2. 运行终端
  3. Navigate to the android/sdk directory
  4. 导航到android/sdk目录。
  5. 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)).
  6. 输入“android”,你会得到一个gui。检查“工具”目录和最新的Android API(此时,它是4.3 (API 18))。
  7. Click "Install xx packages" and go watch an episode of Breaking Bad or something. It'll take a while.
  8. 点击“安装xx包”,观看《绝命毒师》之类的节目。这将需要一段时间。
  9. Go back to IntelliJ and open the "Project Structure..." dialog (Cmd+;).
  10. 回到IntelliJ,打开“项目结构…”对话框(Cmd+;)。
  11. 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.
  12. 在对话框的左面板“项目设置”下,选择项目。在右边的面板中,在“项目SDK”下,单击“New…”> Android SDK,导航到您的Android / SDK目录。选择此选项,您将看到一个对话框,您可以使用该对话框添加“谷歌api”构建目标。这就是我所需要的。如果您有多个版本目标,您可能需要多次执行此操作。
  13. 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.
  14. 现在,在左侧窗格“模块”下,在中心窗格中选择您的项目,在右侧窗格中的“Dependencies”选项卡下选择适当的模块。

#6


3  

Another way to identify the correct SDK is to install Android Studio, create a new project, go to project structure, SDK Location and find where the SDK was installed.

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

I found using the default installation process on a mac that the SDK home folder was in the /Users/'yourUser'/Library/Android/sdk folder. Make sure you have enabled your Mac to view the Library folder.

我发现使用mac上的默认安装过程,SDK主文件夹位于/Users/'yourUser'/Library/Android/ SDK文件夹中。确保你的Mac可以查看库文件夹。

#7


1  

You just need to install Android development kit from http://developer.android.com/sdk/installing/studio.html#Updating

您只需从http://developer.android.com/sdk/installing/studio.html#更新中安装Android开发工具包

and also Download and install Java JDK (Choose the Java platform)

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

define the environment variable in windows System setting https://confluence.atlassian.com/display/DOC/Setting+the+JAVA_HOME+Variable+in+Windows

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

Voila ! You are Donezo !

瞧!你是Donezo !