- Andrey Aleev
- Setup proxy in Android Studio
- Setting certificates
- Configuration
- In this document
- See also
- Update channels
- Proxy Settings
- Setting up the Android Studio Proxy
- Android Plugin for Gradle HTTP proxy settings
- SDK Manager HTTP Proxy Settings
- Андрей Алеев
- Настройка proxy в Android Studio
- Установка сертификатов
- как использовать прокси-соединение с android studio
- 2 ответов
- Настройка Http Proxy в Android Studio
Andrey Aleev
Setup proxy in Android Studio
Recently I was need to setup Android Studio IDE on a windows host with corporate proxy. Topic isn’t new and has been discussed on stackoverflow and in other blogs However, this problem can not be solved immediately – it takes a lot of time and a bit of blood. So I decided to write this post with step-by-step instruction on IDE setup for Android-developer in proxy environment.
We will use windows PC. For linux algorithm would be the same.
After first run Android Studio suggests to configure a proxy:
Click Setup Proxy and enter proxy server address and your credentials:
You can check out your proxy server address with ipconfig (windows)
You may check connection on same window. If everything is OK, move next.
After IDE starts next window appears where you should write your proxy settings again for http and https:
Also, you can set configurations via gradle.properties file:
But keep in mind that IDE’s settings proxy overrides your projects settings .
If you try to compile project now, it will likely fail with error message
Gradle tries to get to repositories servers without certificates. We need to add them into cacerts storage.
But before we will add new lines in gradle.properties:
Here we set path to cacerts storeage file. Default password is changeit. If you didn’t changed it, leave it as it is.
So, how do you add certificates to cacerts?
Setting certificates
After first start IDE suggest to accept certificates. You should accept them, but it may not help. We need to import certificates by hands into cacerts storage of IDE and JVM. To do so perform next steps:
- Download certificate. You may use web-browser or openssl
- Import certificate via keytool
To import downloaded on step 1 certificate on Windows PC run as administrator cmd and type:
Also, add this certificate into other cacerts storages (JVM и Android Studio):
alternatively, instead of adding, we may just copy certificates from one storage to another with next command:
After importing the certificates, clean the gradle cache in the C:\Users\ \.gradle folder and reboot the system.
Also, start Android Studio as administrator if you getting Access denied error when IDE tries to read cacerts file.
Build your project… Build successful!
If certificate import didn’t help, you can try to use regular http instead of https:
Besides gradle, you may face some problems with git also. To avoid 403 error change git global proxy settings. Run command:
And if you see next error when trying to pull/push from/into Git server
SSL certificate problem: self signed certificate in certificate chain
then run next command from administrator :
To be able to push/pull with Android Studio IDE’s Git also change Settings->Version Control->Git section SSH executable set Native
That’s all, we can work! Hope this article was useful for you. If you liked it, leave your comments below!
Источник
Configuration
In this document
See also
During installation, Android Studio provides wizards and templates that verify your system requirements, such as the Java Development Kit (JDK) and available RAM, and configure default settings, such as an optimized default Android Virtual Device (AVD) emulation and updated system images. This document describes additional configuration settings you may want to use to customize your use of Android Studio.
For specific documentation about emulator and device setup and use, see Managing Virtual Devices, Using Hardware Devices, and OEM USB Drivers.
Update channels
Android Studio provides four update channels to keep Android Studio up-to-date based on your code-level preference:
- Canary channel: Canary builds provide bleeding edge releases, updated about weekly. While these builds do get tested, they are still subject to bugs, as we want people to see what’s new as soon as possible. This is not recommended for production.
- Dev channel: Dev builds are hand-picked older canary builds that survived the test of time. They are updated roughly bi-weekly or monthly.
- Beta channel: Beta builds are used for beta-quality releases before a production release.
- Stable channel: Used for stable, production-ready versions.
By default, Android Studio uses the Stable channel. Use File > Settings > Appearance & Behavior System Settings > Updates to change your channel setting.
Proxy Settings
Proxies serve as intermediary connection points between HTTP clients and web servers that add security and privacy to internet connections.
To support running Android Studio behind a firewall, set the proxy settings for the Android Studio IDE and the SDK Manager. Use the Android Studio IDE HTTP Proxy settings page to set the HTTP proxy settings for Android Studio. The SDK Manager has a separate HTTP Proxy settings page.
When running the Android Plugin for Gradle from the command line or on machines where Android Studio is not installed, such as continuous integration servers, set the proxy settings in the Gradle build file.
Note: After the initial installation of the Android Studio bundle, Android Studio can run with internet access or off-line. However, Android Studio requires an internet connection for Setup Wizard synchronization, 3rd-party library access, access to remote repositories, Gradle initialization and synchronization, and Android Studio version updates.
Setting up the Android Studio Proxy
Android Studio supports HTTP proxy settings so you can run Android Studio behind a firewall or secure network. To set the HTTP proxy settings in Android Studio:
- From the main menu choose File > Settings > Appearance & Behavior — System Settings — HTTP Proxy.
- In Android Studio, open the IDE Settings dialog.
- On Windows and Linux, choose File > Settings > IDE Setting — HTTP Proxy.
- On Mac, choose Android Studio > Preferences > IDE Setting — HTTP Proxy.
The HTTP Proxy page appears.
- Select auto-detection to use an auto-configuration URL to configure the proxy settings or manual to enter each of the settings. For a detailed explanation of these settings, see HTTP Proxy.
- Click Apply to enable the proxy settings.
Android Plugin for Gradle HTTP proxy settings
For application-specific HTTP proxy settings, set the proxy settings in the build.gradle file as required for each application module.
For project-wide HTTP proxy settings, set the proxy settings in the gradle/gradle.properties file.
For information about using Gradle properties for proxy settings, see the Gradle User Guide.
Note: When using Android Studio, the settings in the Android Studio IDE HTTP proxy settings page override the HTTP proxy settings in the gradle.properties file.
SDK Manager HTTP Proxy Settings
SDK Manager proxy settings enable proxy internet access for Android package and library updates from SDK Manager packages.
To set the SDK Manager settings for proxy internet access, start the SDK Manager and open the SDK Manager page.
- On Windows, select Tools > Options from the menu bar.
- On Mac and Linux, choose Tools > Options from the system menu bar.
The Android SDK Manager page appears. Enter the settings and click Apply.
Источник
Андрей Алеев
Настройка proxy в Android Studio
На днях мне пришлось разворачивать Android Studio IDE на машине с корпоративным прокси. Тема не нова, и уже обсуждалась на stackoverflow и в блогах. Однако, эта задача не решается сходу — приходиться покопаться. Поэтому я решил создать пошаговую инструкцию по настройке IDE Android-разработчика в условиях прокси.
Все действия мы будем проводить на windows-машине. Для linux алгоритм будет аналогичный.
Итак, при первом запуске Android Studio предлагает настроить прокси
Жмем Setup Proxy, вводим адрес прокси-сервера и свои учетные данные:
Адрес прокси можно узнать с помощью команды (windows)
Протестируйте соединение с помощью кнопки Check connection на этом же окне. Если все ок, идем дальше.
Все ок, идем дальше. В появившемся после запуска IDE окне прокси нужно снова прописать параметры proxy для http и https:
Эти же настройки можно прописать в файле gradle.properties:
Однако, имейте ввиду, что настройки прокси IDE перезаписывают настройки проекта .
Если сейчас попытаться собрать проект, то, скорее всего, сборка закончится неуспешно с ошибкой
Gradle пытается достучаться до серверов репозиториев, не имея сертификатов. Нам необходимо добавить их в хранилища. Для этого сначала добавляем в gradle.properties следующие строчки:
Здесь мы указываем путь и пароль к хранилищу сертификатов. Пароль по умолчанию — changeit. Если вы не меняли его, он остался таким же.
Как же добавить сертификаты в хранилище?
Установка сертификатов
При запуске проекте IDE предлагает принять сертификаты. Их следует принять, однако это не поможет автоматически. Нам необходимо импортировать сертификаты в хранилище сертификатов cacerts IDE и JVM. Для этого необходимо выполнить следующие шаги:
- Скачать сертификат. Сделать это можно с помощью браузера или openssl
- Импортировать сертификат в в хранилища с помощью keytool
Чтобы импортировать загруженный на шаге 1 сертификат, на Windows-машине необходимо запустить командную строку от администратора и выполнить:
Также, необходимо добавить этот сертификат в другие хранилища cacerts (JVM и Android Studio):
альтернативно, вместо того, чтобы добавлять, можно копировать сертификаты между хранилищами с помощью команды:
После импорта сертификатов почистите кэш gradle в папке C:\Users\ \.gradle и перезагрузите систему. Если при попытке обратиться к хранилищу cacerts IDE выдает ошибку Access denied, запустите Android Studio от администратора.
Запускаем сборку… Проект успешно собирается!
В случае, если импорт сертификатов не помогает, можно заменить адрес загрузки репозиториев с секьюрного https на обычный http:
Помимо gradle, проблемы могут возникнуть и с системой контроля версий. В случае с git необходимо необходимо добавить в глобальные настройки git параметры proxy. Для этого выполнить команду:
Если при попытке при попытке pull/push из/в GitLab возникает ошибка
SSL certificate problem: self signed certificate in certificate chain
то следует выполнить следующую команду от администратора:
Для возможности push/pull через IDE Android Studio необходимо в настройках Settings->Version Control->Git в пункте SSH executable указать Native
На этом все, можно работать. Надеюсь, статья оказалась полезной для вас. Буду рад вашим мнениям и комментариям!
Источник
как использовать прокси-соединение с android studio
Я пытаюсь запустить приложение «hello world» в Android studio. Мое соединение через прокси. Когда я пытаюсь запустить «hello world app», android studio показывает мне следующую ошибку:
ошибка запуска Prueba:ошибка синхронизации проекта Gradle. Пожалуйста, исправьте свой проект и повторите попытку.
Если я настраиваю в: «File / setting — > HTTP Proxy» и затем ставлю свою конфигурацию прокси, ошибка следующая:
ошибка:не удалось получить ‘http://jcenter.bintray.com/com/android/tools/build/gradle/0.12.2/gradle-0.12.2.pom’ — . Получен код состояния 407 от сервера: требуется проверка подлинности прокси ( для выполнения запроса ISA Server требуется авторизация. Доступ к фильтру веб-прокси запрещен. ) Enable Gradle ‘offline mode’ and sync project
Как я могу исправить эту ошибку?
2 ответов
там ошибка указывает, что требуется аутентификация прокси-сервера. Для проверки подлинности на прокси-сервере вернитесь к файлу — >настройка — >HTTP прокси, установите флажок для проверки подлинности прокси и введите свои учетные данные там. Кроме того, нажмите кнопку проверить соединение, чтобы проверить, что соединение успешно.
В Android Studio 1.4 есть два места, прокси-сервер должен быть настроен: сначала в Android Studio, как Майк описал в своем ответе. И второй во внешнем менеджере SDK:
Android-студия | инструменты | Андроид | СДК-менеджер | автономный запуск Диспетчера SDK | Инструменты | Настройки
после установки прокси-сервера в Диспетчере SDK проблема также была исправлена.
Источник
Настройка Http Proxy в Android Studio
Я прочитал несколько похожих вопросов и документацию, но я не смог решить мою проблему с помощью корпоративного брандмауэра, на котором сидит моя машина. Ошибка, которую я получаю, – «Не удалось обновить проект Gradle» Неизвестный хост services.gradle.org. Все, что я прочитал и понял, заставляет меня поверить, что это проблема прокси-сервера. Я попытался установить свойства прокси в файле gradle.properties в моей папке Project, так что файл gradle.properties выглядит так:
Я также попытался установить глобальные настройки градиента, перейдя в «Файл-> Настройки->« Грейдл »и установив параметры« Грейд-ВМ », используя:
Я не вижу никакой документации о том, где еще установить этот параметр http-прокси, пожалуйста, помогите, если сможете.
Попробуйте добавить домен в глобальные настройки градации
Это помогает мне.
Имел аналогичную проблему, получив студию андроида, чтобы открыть корпоративный брандмауэр. После сбоев поиска SDK и сбоев он потерпит крах. Я использовал бесплатное программное обеспечение под названием «proxycap» и вводил настройки прокси для корпорации (доступные в настройках Интернета моего компьютера). Теперь все отлично! Есть другие proxy freewares (proxify …), но я выбрал это одна из программ с настройками прокси-уровня на уровне программы, где я мог бы настроить прокси-сервер для студии Android.
Я не знаю, была ли опция proxy в предыдущей версии, но в v1.0.1 и выше вы можете найти ее в настройках File-> Settings -> IDE.
Источник