Содержание
- Before you start
- Choosing the module type you need
- Creating an Android project
- Adding an Andro >File | New | Module from the main menu or New | Module from the context menu of the Project tool window.
- Attaching an Andro >You need to perform this procedure if you want to attach an Android facet to an existing Java module. Android modules have this facet applied by default.
- Configuring the code style of Andro > Android development involves working with dedicated XML files, such as layout and resource definition files, manifest files, etc. You can have IntelliJ IDEA apply the standard XML code style to such files, or configure custom code style settings for them.
- 2 ответа 2
- Before you start
- Choosing the module type you need
- Creating an Android project
- Adding an Andro >File | New | Module from the main menu or New | Module from the context menu of the Project tool window.
- Attaching an Andro >You need to perform this procedure if you want to attach an Android facet to an existing Java module. Android modules have this facet applied by default.
- Configuring the code style of Andro > Android development involves working with dedicated XML files, such as layout and resource definition files, manifest files, etc. You can have IntelliJ IDEA apply the standard XML code style to such files, or configure custom code style settings for them.
- 2 ответа 2
Before you start
- Download and extract the Andro > The Android SDK is not a substitute for a Java SDK (JDK). You need to download and configure a Java SDK for your project anyway.
Add SDK packages. For detailed instructions and download links, refer to Adding SDK Packages.
Configure the Android SDK in IntelliJ IDEA, see SDKs.
Make sure that the bundled Android Support plugin is activated. This plugin provides Android support at the IntelliJ IDEA level and is enabled by default. If not, enable it as described in Managing plugins.
Depending on your task, choose the module type you need for your Android development.
Starting with the IntelliJ IDEA version 2016.1, non-Gradle Android projects are not supported.
Choosing the module type you need
IntelliJ IDEA lets you choose Application modules (form factors) when you create your project, add different Android modules to an existing project, or add Android facets to your modules.
Creating an Android project
In the menu, choose File | New | Project to open the New Project Wizard. In the left-hand pane select Android .
In the right-hand pane configure your new project and click Next .
On the next page of the wizard, select the application module type and its minimum SDK. Click Next .
On the next page of the wizard, select the Andro >Next .
On the next page of the wizard, specify the Activity settings and click Finish .
Adding an Andro >File | New | Module from the main menu or New | Module from the context menu of the Project tool window.
The New Module wizard opens.
In the left-hand pane, select Android . In the right-hand pane, select a module you want to add and click Next .
On the next page of the wizard, specify the application or library name, module name, package name and a minimum SDK that is required for this type of application. Click Next .
On the next page of the wizard, select an activity for your module and click Next .
On the next page of the wizard, specify the settings to customize the selected activity and click Finish .
Attaching an Andro >You need to perform this procedure if you want to attach an Android facet to an existing Java module. Android modules have this facet applied by default.
Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S ).
Under Project Settings , select Modules .
Select the module you want to add an Andro >Android .
To make the module source code and resources available from other projects, select the Library module checkbox on top of this page.
Configuring the code style of Andro > Android development involves working with dedicated XML files, such as layout and resource definition files, manifest files, etc. You can have IntelliJ IDEA apply the standard XML code style to such files, or configure custom code style settings for them.
Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or IntelliJ IDEA | Preferences for macOS. Expand the Editor node, and then click XML under Code Style .
On the Code Style:XML page that opens, switch to the Android tab.
To define a custom code style for Andro >Use custom formatting settings for Android XML files checkbox and configure the settings to be applied to various types of Android XML files using the controls of the tab as described in Code Style:XML — Android.
To have IntelliJ >Use custom formatting settings for Android XML files checkbox.
Установка будет проводится на Windows 7 (x64).
Саму Anddro > Сразу после запуска возникает проблема с тем, что инсталлятор не может определить где находится Java SDK. Решается следующим образом:
- Открываем свойства компьютера, выбираем пункт «Дополнительные параметры системы»
- На вкладке «Дополнительно» жмем на кнопку «Переменные среды…»
- В верхний список «Переменные среды пользователя…» добавляем новый элемент (нажимаем на кнопку «Создать..»)
- В появившемся диалоговом окне в поле «Имя переменной:» вставляем «JAVA_HOME», в поле «Значение переменной»: полный путь к корневой директории Java SDK, например: «D:Program FilesJavajdk1.7.0_17»
- Снова запускаем инсталлятор (или нажимаем кнопку «Назад», а затем «Вперед») — все должно заработать.
Дальше устанавливаем саму SDK и в конце запускаем Android SDK Manager. В качестве устанавливаемых пакетов необходимо как минимум следующее:
- Android SDK Tools
- Android SDK Platform-tools
- Версия Android для которой будет вестись разработка (можете установить все в пакете, лучше больше, если вам не до конца понятно что там конкретно)
- Версия Android для минимальной совместимости (обычно это версия 2.2), также рекомендую поставить версию 3.0, так как там есть некоторые переходные моменты (это как бы минимальная версия для некоторых возможностей 4-й версии)
- Жмем «Install packages» и ждем загрузки (размер не маленький сразу предупреждаю)
- В открывшемся окне проверяем чтобы для всех пакетов вы приняли лицензию (иначе они не установятся). Т.е. слева пакеты — справа окно лицензии с галкой «Согласен», проверьте чтобы пакеты загорелись зелеными маркерами слева.
Далее необходимо настроить Java SDK и непосредственно Android SDK.Для этого в открывшимся окне выбора проектов IDE нажимаем «Ctrl+Shift+Alt+S» (для настройки платформ) и выбираем пункт «SDKs». Нажимаем кнопку «+» вверху, выбираем «JDK» (без этого Android SDK работать не будет, т.к. IDE не знает для какой версии Java вы настраиваете Android SDK. Указываете где расположена ваш версия Java SDK (SE) и нажимаете «Ok».
Теперь в том же окне добавляем Android SDK — указываем его расположение.
Все, на этом ваша IDE полностью готова к началу разработки приложений для платформы Android.
Не могу установить Android SDK для IntelliJ IDEA, который я скачал с сайта https://developer.android.com/studio/index.html (sdk-tools-windows-3859397).
Инсталятора нигде не видно, при запуске экзешников открывается на секунду командная строка и всё, даже с помощью прав администратора.
2 ответа 2
Ставил я это все дело первый раз, так что насколько все правильно я не знаю. Напишу что я сделал чтобы заработало.
Ставим jdk с версией 1.8. С версией 1.7 sdkmanager у меня работать не хотел.
Распаковываем содержимое архива например в C:AndroidSdk ools. Если я все правильно понял, то папка tools обязательна.
Создаем переменную среды ANDRO >
Устанавливаем через sdkmanager пакеты. Я поставил следующие.
- platforms;android-19 — версию выбираем нужную
- build-tools;19.1.0 — не уверен что версия должна совпадать с platforms;android
- platform-tools
- extras;android;m2repository — без этого проект не соберется
Все теперь можно скармливать IntelliJ IDEA папку C:AndroidSdk.
PS: Пока пытался ставить пробовал разные варианты и у меня не работало пока не поставил именно пакет platforms;android-19. После этого идея распознала папку C:AndroidSdk как sdk. Возможно идеи нужен установленный хотя бы один sdk.
Источник: