- AOSP AndroidX Contribution Guide
- Accepted Types of Contributions
- Checking Out the Code
- Using Android Studio
- Builds
- Full Build (Optional)
- Testing modified AndroidX Libraries to in your App
- Running Tests
- Single Test Class or Method
- Full Test Package
- Running Sample Apps
- Password and Contributor Agreement before making a change
- Making a change
- Android Jetpack
- Contribution Guide
- Code Review Etiquette
- Accepted Types of Contributions
- Checking Out the Code
- Using Android Studio
- Builds
- Full Build (Optional)
- Testing modified AndroidX Libraries to in your App
- Continuous integration
- Running Tests
- Single Test Class or Method
- Full Test Package
- Running Sample Apps
- Password and Contributor Agreement before making a change
- Making a change
- Getting reviewed
- Handling binary dependencies
- Строим Android x86
- Установка окружения для сборки
- Загрузка дерева исходных кодов
- Загрузка файлов
- Сборка ядра
- Построение Android
- Настройка VirtualBox
- Эмулятор Jelly Bean
AOSP AndroidX Contribution Guide
Accepted Types of Contributions
- Bug fixes — needs a corresponding bug report in the Android Issue Tracker
- Each bug fix is expected to come with tests
- Fixing spelling errors
- Updating documentation
- Adding new tests to the area that is not currently covered by tests
- New features to existing libraries if the feature request bug has been approved by an AndroidX team member.
We are not currently accepting new modules.
Checking Out the Code
NOTE: You will need to use Linux or Mac OS. Building under Windows is not currently supported.
Follow the “Downloading the Source” guide to install and set up repo tool, but instead of running the listed repo commands to initialize the repository, run the folowing:
The first time you initialize the repository, it will ask for user name and email.
Now your repository is set to pull only what you need for building and running AndroidX libraries. Download the code (and grab a coffee while we pull down 3GB):
You will use this command to sync your checkout in the future — it’s similar to git fetch
Using Android Studio
Open path/to/checkout/frameworks/support/ in Android Studio. Now you’re ready edit, run, and test!
If you get “Unregistered VCS root detected” click “Add root” to enable git integration for Android Studio.
If you see any warnings (red underlines) run Build > Clean Project .
Builds
Full Build (Optional)
You can do most of your work from Android Studio, however you can also build the full AndroidX library from command line:
Testing modified AndroidX Libraries to in your App
You can build maven artifacts locally, and test them directly in your app:
And put in your project build.gradle file:
Running Tests
Single Test Class or Method
- Open the desired test file in Android Studio.
- Right-click on a test class or @Test method name and select Run FooBarTest
Full Test Package
- In the project side panel open the desired module.
- Find the directory with the tests
- Right-click on the directory and select Run androidx.foobar
Running Sample Apps
The AndroidX repository has a set of Android applications that exercise AndroidX code. These applications can be useful when you want to debug a real running application, or reproduce a problem interactively, before writing test code.
These applications are named either
-integration-tests-testapp , or support-\*-demos (e.g. support-4v-demos or support-leanback-demos ). You can run them by clicking Run > Run . and choosing the desired application.
Password and Contributor Agreement before making a change
Before uploading your first contribution, you will need setup a password and agree to the contribution agreement:
Making a change
If you see the following prompt, choose always :
If the upload succeeds, you’ll see output like:
To edit your change, use git commit —amend , and re-upload.
Источник
Android Jetpack
Jetpack is a suite of libraries, tools, and guidance to help developers write high-quality apps easier. These components help you follow best practices, free you from writing boilerplate code, and simplify complex tasks, so you can focus on the code you care about.
Jetpack comprises the androidx.* package libraries, unbundled from the platform APIs. This means that it offers backward compatibility and is updated more frequently than the Android platform, making sure you always have access to the latest and greatest versions of the Jetpack components.
Our official AARs and JARs binaries are distributed through Google Maven.
You can learn more about using it from Android Jetpack landing page.
Contribution Guide
For contributions via GitHub, see the GitHub Contribution Guide.
Note: The contributions workflow via GitHub is currently experimental — only contributions to the following projects are being accepted at this time:
Code Review Etiquette
When contributing to Jetpack, follow the code review etiquette.
Accepted Types of Contributions
- Bug fixes — needs a corresponding bug report in the Android Issue Tracker
- Each bug fix is expected to come with tests
- Fixing spelling errors
- Updating documentation
- Adding new tests to the area that is not currently covered by tests
- New features to existing libraries if the feature request bug has been approved by an AndroidX team member.
We are not currently accepting new modules.
Checking Out the Code
NOTE: You will need to use Linux or Mac OS. Building under Windows is not currently supported.
- Install repo (Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see the Repo Command Reference)
- Configure Git with your real name and email address.
- Create a directory for your checkout (it can be any name)
- Use repo command to initialize the repository.
- Now your repository is set to pull only what you need for building and running AndroidX libraries. Download the code (and grab a coffee while we pull down the files):
You will use this command to sync your checkout in the future — it’s similar to git fetch
Using Android Studio
To open the project with the specific version of Android Studio recommended for developing:
and accept the license agreement when prompted. Now you’re ready to edit, run, and test!
You can also the following sets of projects: ALL , MAIN , COMPOSE , or FLAN
If you get “Unregistered VCS root detected” click “Add root” to enable git integration for Android Studio.
If you see any warnings (red underlines) run Build > Clean Project .
Builds
Full Build (Optional)
You can do most of your work from Android Studio, however you can also build the full AndroidX library from command line:
Testing modified AndroidX Libraries to in your App
You can build maven artifacts locally, and test them directly in your app:
And put the following at the top of your ‘repositories’ property in your project build.gradle file:
NOTE: In order to see your changes in the project, you might need to clean your build ( Build > Clean Project in Android Studio or run ./gradlew clean ).
Continuous integration
Our continuous integration system builds all in progress (and potentially unstable) libraries as new changes are merged. You can manually download these AARs and JARs for your experimentation.
Running Tests
Single Test Class or Method
- Open the desired test file in Android Studio.
- Right-click on a test class or @Test method name and select Run FooBarTest
Full Test Package
- In the project side panel open the desired module.
- Find the directory with the tests
- Right-click on the directory and select Run androidx.foobar
Running Sample Apps
The AndroidX repository has a set of Android applications that exercise AndroidX code. These applications can be useful when you want to debug a real running application, or reproduce a problem interactively, before writing test code.
These applications are named either
-integration-tests-testapp , or support-\*-demos (e.g. support-v4-demos or support-leanback-demos ). You can run them by clicking Run > Run . and choosing the desired application.
Password and Contributor Agreement before making a change
Before uploading your first contribution, you will need setup a password and agree to the contribution agreement:
Making a change
If you see the following prompt, choose always :
If the upload succeeds, you’ll see output like:
To edit your change, use git commit —amend , and re-upload.
Getting reviewed
- After you run repo upload, open r.android.com
- Sign in into your account (or create one if you do not have one yet)
- Add an appropriate reviewer (use git log to find who did most modifications on the file you are fixing or check the OWNERS file in the project’s directory)
Handling binary dependencies
AndroidX uses git to store all the binary Gradle dependencies. They are stored in prebuilts/androidx/internal and prebuilts/androidx/external directories in your checkout. All the dependencies in these directories are also available from google() , jcenter() , or mavenCentral() . We store copies of these dependencies to have hermetic builds. You can pull in a new dependency using our importMaven tool.
Источник
Строим Android x86
Установка окружения для сборки
Для сборки Android потребуется 64 битная версия Linux. Еще один важный момент: обратите внимание на версию GCC, которая установлена на системе. Google поддерживает версию GCC 4.4 и выше. Так же на системе должна быть установлена реализация Java от Oracle.
Установка дополнительных зависимостей для Ubuntu 12.04:
Установите символьную ссылку для устранения конфликта имен:
Загрузка дерева исходных кодов
Установка Repo
Repo — утилита управления репозиториями, упрощающая работу с Git для Android. Более подробную информацию можно прочесть здесь (http://source.android.com/source/version-control.html)
Для установки, инициализации и настройки Repo выполните следующие шаги:
• Убедитесь, что у вас есть директория bin в вашем домашнем каталоге и она прописана в PATH:
• Загрузите Repo скрипт и выставите права на выполнение:
Инициализация Repo клиента
После установки Repo, настройте доступ к репозиториям исходных кодов Android:
• Создайте пустую директорию для исходных файлов и перейдите в нее. Например, это может выглядеть так:
• Запустите скрипт repo init, чтобы обновить версию самого Repo.
Эта команда подключит ветку master из дерева исходных кодов Android. Вы можете указать любую другую, используя ключ -b:
Для просмотра всех доступных веток введите команду:
Нас интересуют наиболее последние версии Android от Google:
- Jelly Bean: remotes/origin/android-4.1.1_r6
- Ice Cream Sandwich: remotes/origin/android-4.0.4_r2.1
Можно выбрать любую на ваш вкус, дальнейшие шаги не будут отличаться. Для демонстрации процесса сборки под VirtualBox возьмем версию Jelly Bean (JB).
В случае успешной инициализации вы увидите сообщение о том, что Repo инициализирован в вашей директории и в ней появится папка .repo
Загрузка файлов
Чтобы загрузить исходные файлы из репозитория в вашу рабочую директорию выполните команду:
Начальная синхронизация может занять больше часа времени.
Сборка ядра
Android разработан прежде всего для устройств, управляемых жестами и он не поддерживает мышь по умолчанию. Поэтому, в качестве примера, пересоберем ядро из исходников с включенной поддержкой мыши.
Создадим директорию для хранения исходников ядра:
Воспользуемся заранее подготовленной версией ядра от Intel:
Перейдем в директорию ядра:
Теперь у нас есть исходники ядра. Нужно модифицировать конфигурационный файл и пересобрать. Чтобы сократить время на полную настройку ядра, воспользуемся конфигурационным файлом, который подготовили для на разработчики. Важный момент — не забывайте указать архитектуру для которой происходит сборка ядра, в нашем случае это x86.
Через несколько секунд загрузится графическое меню настройки ядра. Стрелками «вверх», «вниз» вы можете передвигаться по пунктам меню, «Enter» чтобы зайти в подменю. Все точно так же как с обычным ядром Linux.
Чтобы включить поддержку мыши:
• Зайдите в «Device Drivers»
• Выберите «Input device Support»
• Отметьте «Mice»
Вы можете зайти в подменю «Mice» и посмотреть дополнительные настройки драйверов.
Затем выйдите из меню конфигурации ядра. Это можно сделать с помощью нескольких нажатий на «Esc». Не забудьте сохранить настройки, когда меню конфигурации предложит это сделать.
Сделав необходимые настройки ядра, соберем его. Это не займет много времени, особенно если вы используете многоядерную машину — можете указать опцию команды make: -j N, где N — число ядер (например, для написания статьи использовалась make -j 32).
При успешной компиляции вы увидите сообщение:
Путь до нового ядра указан в последней строке.
Подмена ядра
Путь к ядру, которое будет использовано в сборке для VirtualBox можно определить следующим образом:
Должно вывестись примерно следующее:
Скопируем bzImage по найденному пути:
Построение Android
Установим окружение для сборки:
Теперь все готово к тому, чтобы начать компиляцию исходников Android. Первым шагом необходимо указать цель для сборки:
После выполнения команды вы увидите информацию о предстоящей сборке:
Затем необходимо запустить сборку исходников командой make. Хорошим тоном считается сохранять лог сборки, это можно сделать с помощью утилиты tee.
Процесс сборки может занять значительное время, конкретные цифры зависят от мощности центрального процессора и объема оперативной памяти машины. На системе, которая использовалась для подготовки статьи это заняло около часа. Рекомендуемое число потоков для сборки можно определить из расчета 2GB оперативной памяти на поток.
При успешной компиляции, последняя строка вывода будет содержать путь и размер образа:
Далее необходимо собрать загрузочный образ для VirtualBox:
Если сборка прошла успешно, в консоли должна появиться запись:
Настройка VirtualBox
Эмулятор Jelly Bean
Сборка эмулятора мало чем отличается от сборки версии для VirtualBox. Если у вас уже есть исходные коды, то приступайте к сборке с шага инициализации окружения. Для чистоты эксперимента, будет процесс постройки эмулятора будет изложен с самого начала. Поэтому создадим отдельную директорию для Jelly Bean Emulator и повторим уже знакомые шаги.
Загрузка исходных кодов
Выбор сборки эмулятора
В случае успеха вы увидите:
Пока идет процесс компиляции, скопируем конфигурационный файл и соберем ядро для эмулятора.
Теперь сборка эмулятора завершена.
Самый простой способ запустить его:
Например, можно запустить с только что собранным ядром, с разрешением 480×800, объемом оперативной памяти 512 мегабайт и включенным аппаратным ускорением графики.
Более подробно о возможностях и настройках эмулятора можно прочитать здесь
Источник