{"id":208,"date":"2024-06-24T18:10:13","date_gmt":"2024-06-24T10:10:13","guid":{"rendered":"https:\/\/www.swreader.com\/?p=208"},"modified":"2024-06-24T18:35:26","modified_gmt":"2024-06-24T10:35:26","slug":"installing-android-12-environment-dependencies","status":"publish","type":"post","link":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/","title":{"rendered":"Setup Android 12 Build Environment"},"content":{"rendered":"<p>This is the first article in the Android series, introducing the process of setting up and debugging the Android development environment. The following demonstrates the process of setting up the environment on Ubuntu 20.04.<\/p>\n<h2>Installing Android 12 Environment Dependencies<\/h2>\n<p>Reference documentation for environment dependencies: <a href=\"https:\/\/source.android.google.cn\/source\/initializing?hl=zh-cn\">Setting Up the Build Environment<\/a><\/p>\n<pre><code class=\"language-shell\">sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig<\/code><\/pre>\n<h2>Downloading Android 12 Source Code<\/h2>\n<h3>Downloading the Repo Tool<\/h3>\n<h4>Downloading the Repo Tool<\/h4>\n<p>AOSP code is managed via git, and multiple git repositories are managed using the repo tool. Before downloading the code, you need to download the repo tool. For Ubuntu, the repo tool is available in the Ubuntu software source and can be installed directly via apt:<\/p>\n<pre><code class=\"language-shell\"># Debian\/Ubuntu.\n$ sudo apt-get install repo<\/code><\/pre>\n<p>Alternatively, you can install it by executing the following script:<\/p>\n<pre><code class=\"language-shell\">$ mkdir -p ~\/.bin\n$ PATH=&quot;${HOME}\/.bin:${PATH}&quot;\n$ curl https:\/\/storage.googleapis.com\/git-repo-downloads\/repo &gt; ~\/.bin\/repo\n$ chmod a+rx ~\/.bin\/repo<\/code><\/pre>\n<h4>Modifying the Repo Tool for Domestic Use<\/h4>\n<p>Since AOSP code cannot be downloaded from Google&#8217;s servers in China, the repo tool needs to be modified to download from a domestic mirror server. For example, to download from USTC mirrors, use the vim tool to modify the REPO_URL in the repo script to <a href=\"https:\/\/gerrit-googlesource.proxy.ustclug.org\/git-repo\">https:\/\/gerrit-googlesource.proxy.ustclug.org\/git-repo<\/a><\/p>\n<pre><code class=\"language-shell\">vim ~\/.bin\/repo<\/code><\/pre>\n<p>Add the following on line 143:<\/p>\n<pre><code class=\"language-python\"> 140 # repo default configuration\n 141 #\n 142 REPO_URL = os.environ.get(&#039;REPO_URL&#039;, None)\n 143 REPO_URL = &#039;https:\/\/gerrit-googlesource.proxy.ustclug.org\/git-repo&#039;\n 144 if not REPO_URL:\n 145   REPO_URL = &#039;https:\/\/gerrit.googlesource.com\/git-repo&#039;\n 146 REPO_REV = os.environ.get(&#039;REPO_REV&#039;)\n 147 if not REPO_REV:\n 148   REPO_REV = &#039;stable&#039;<\/code><\/pre>\n<p>For repo command reference, see <a href=\"https:\/\/gerrit.googlesource.com\/git-repo\/+\/refs\/heads\/master\/README.md\">repo<\/a>.<\/p>\n<h3>Downloading the Code<\/h3>\n<p>Since direct access is not available in China, use Tsinghua or USTC mirrors for AOSP sources.<\/p>\n<ul>\n<li><a href=\"https:\/\/mirrors.tuna.tsinghua.edu.cn\/aosp-monthly\/\">Tsinghua Mirror<\/a><\/li>\n<li><a href=\"https:\/\/mirrors.ustc.edu.cn\/help\/aosp.html\">USTC Mirror<\/a><\/li>\n<\/ul>\n<p>The following explains how to download the Android 12 r3 code:<\/p>\n<ol>\n<li>\n<p>Create and enter the android12_12.1.0.r3 directory.<\/p>\n<\/li>\n<li>\n<p>Initialize the code repository:<\/p>\n<pre><code class=\"language-shell\">repo init -u git:\/\/mirrors.ustc.edu.cn\/aosp\/platform\/manifest -b android-12.1.0_r3<\/code><\/pre>\n<p>To download code from other branches, modify the -b parameter. For branch information, see <a href=\"https:\/\/source.android.com\/setup\/start\/build-numbers#source-code-tags-and-builds\">Android Branch Description<\/a>.<\/p>\n<\/li>\n<li>\n<p>Sync the Code<br \/>\nThe Android codebase is large, and syncing the code will take some time. It is recommended to have at least 200G of available space on your PC. The following command syncs the code using 8 threads:<\/p>\n<pre><code class=\"language-shell\">repo sync -c -j8<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>Reference documentation for downloading the code: <a href=\"https:\/\/source.android.com\/setup\/build\/downloading\">Downloading the Source<\/a>.<\/p>\n<h2>Compiling the Code<\/h2>\n<p>Compilation involves three steps: initializing the build environment, selecting the product, and compiling:<\/p>\n<ol>\n<li>\n<p>Initialize the Build Environment<\/p>\n<pre><code class=\"language-shell\">source build\/envsetup.sh<\/code><\/pre>\n<p>The build\/envsetup.sh is a shell script that defines very useful commands for Android compilation, code search, file search, directory navigation, etc. Due to the large amount of Android code and deep directories, these commands greatly improve efficiency. For detailed instructions, see this file or enter the hmm command for help.<\/p>\n<\/li>\n<li>\n<p>Select the Product<br \/>\nUse lunch to select the product to compile. This document uses the x86_x64 emulator image as an example.<\/p>\n<\/li>\n<\/ol>\n<p>(1). Modify AndroidProduct.mk to support x86_x64 image compilation<br \/>\nSince the default lunch option in Android 12 does not include the emulator image, the mk file needs to be modified first.<br \/>\nModify build\/make\/target\/product\/AndroidProducts.mk to add sdk_phone_x86_64-eng support:<\/p>\n<pre><code class=\"language-diff\">diff --git a\/target\/product\/AndroidProducts.mk b\/target\/product\/AndroidProducts.mk\nindex 7d9d90e92a..419cccb80a 100644\n--- a\/target\/product\/AndroidProducts.mk\n+++ b\/target\/product\/AndroidProducts.mk\n@@ -84,3 +84,4 @@ COMMON_LUNCH_CHOICES := \\\n     aosp_arm-eng \\\n     aosp_x86_64-eng \\\n     aosp_x86-eng \\\n+    sdk_phone_x86_64-eng \\<\/code><\/pre>\n<p>Reference <a href=\"https:\/\/www.reddit.com\/r\/androiddev\/comments\/odz9sp\/building_aosp_error\/\">Modification<\/a>.<\/p>\n<p>(2). Execute the lunch command to select the product:<\/p>\n<pre><code class=\"language-shell\">lunch sdk_phone_x86_64-eng<\/code><\/pre>\n<ol start=\"3\">\n<li>Start Compilation<br \/>\nEnter the m command to start compilation directly, or you can manually specify the number of threads for compilation.<\/p>\n<pre><code class=\"language-shell\">~\/code\/android12_12.1.0.r3$ m\nbuild\/make\/core\/soong_config.mk:195: warning: BOARD_PLAT_PUBLIC_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS instead.\nbuild\/make\/core\/soong_config.mk:196: warning: BOARD_PLAT_PRIVATE_SEPOLICY_DIR has been deprecated. Use SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS instead.<\/code><\/pre>\n<p>After compilation is complete, the output is as follows:<\/p>\n<pre><code class=\"language-shell\">......\n#### build completed successfully (29:45 (mm:ss)) ####<\/code><\/pre>\n<p>The generated image can be found in the out\/target\/product\/emulator_x86_64 directory, with the following files:<\/p>\n<pre><code class=\"language-shell\">out\/target\/product\/emulator_x86_64$ ls -ah *.img\ncache.img          product.img        ramdisk.img               super_empty.img  system_ext-qemu.img  userdata.img       vendor_boot-debug.img         vendor.img\ndtb.img            product-qemu.img   ramdisk-qemu.img          super.img        system.img           userdata-qemu.img  vendor_boot.img               vendor-qemu.img\nencryptionkey.img  ramdisk-debug.img  ramdisk-test-harness.img  system_ext.img   system-qemu.img      vbmeta.img  <\/code><\/pre>\n<\/li>\n<\/ol>\n<h2>Running the Emulator<\/h2>\n<p>After successful compilation, enter the emulator command in the compilation window to start the Android emulator, which will use the image just compiled.<\/p>\n<pre><code class=\"language-shell\">\/code\/android12_12.1.0.r3\/out\/target\/product\/emulator_x86_64$ emulator\nemulator: Android emulator version 30.9.0.0 (build_id 7651928) (CL:N\/A)\n2022-04-21 15:06:36.680 bluetooth - \/buildbot\/src\/android\/emu-master-dev\/system\/bt\/vendor_libs\/test_vendor_lib\/model\/setup\/device_boutique.cc:33 - Register: Registering beacon_swarm\n2022-04-21 15:06:36.680 bluetooth - \/buildbot\/src\/android\/emu-master-dev\/system\/bt\/vendor_libs\/test_vendor_lib\/model\/setup\/device_boutique.cc:33 - Register: Registering beacon<\/code><\/pre>\n<p>The execution results are as follows:<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.swreader.com\/wp-content\/uploads\/2024\/06\/image-1719223086105.png\" alt=\"file\" \/><br \/>\n<strong>Note:<\/strong><\/p>\n<ol>\n<li>The emulator command here is set by source build\/envsetup.sh and lunch during code compilation. The actual location of the emulator is under prebuilts\/android-emulator in the Android source code:\n<pre><code class=\"language-shell\">~\/code\/android12_12.1.0.r3\/out\/target\/product\/emulator_x86_64$ which emulator\n\/home\/zdm\/code\/android12_12.1.0.r3\/prebuilts\/android-emulator\/linux-x86_64\/emulator<\/code><\/pre>\n<\/li>\n<li>If the following error occurs when running the emulator:\n<pre><code class=\"language-shell\">mulator: ERROR: Running multiple emulators with the same AVD is an experimental feature.\nPlease use -read-only flag to enable this feature.<\/code><\/pre>\n<p>It indicates that an emulator is already running, or it exited abnormally. Delete the following two lock files to run normally:<\/p>\n<pre><code class=\"language-shell\">$ croot\n$ cd out\/target\/product\/emulator_x86_64\n$ ls *.lock\nhardware-qemu.ini.lock  multiinstance.lock<\/code><\/pre>\n<p>For emulator command reference, see <a href=\"https:\/\/developer.android.com\/studio\/run\/emulator-commandline\">manual<\/a>.<\/p>\n<\/li>\n<\/ol>\n<h2>Compiling Related to Emulator Kernel<\/h2>\n<p><a href=\"https:\/\/gabrio-tognozzi.medium.com\/run-android-emulator-with-a-custom-kernel-547287ef708c\">https:\/\/gabrio-tognozzi.medium.com\/run-android-emulator-with-a-custom-kernel-547287ef708c<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/ldswfun\/article\/details\/119786846\">https:\/\/blog.csdn.net\/ldswfun\/article\/details\/119786846<\/a><br \/>\n<a href=\"https:\/\/download.csdn.net\/learn\/35479\/529617?spm=1002.2001.3001.4157\">https:\/\/download.csdn.net\/learn\/35479\/529617?spm=1002.2001.3001.4157<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the first article in the Android series, introducing the process of setting up and debugging the Android development environment. The following demonstrates the process of setting up the environment on Ubuntu 20.04. Installing Android 12 Environment Dependencies Reference documentation for environment dependencies: Setting Up the Build Environment sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig Downloading Android 12 Source Code Downloading the Repo Tool Downloading the Repo Tool AOSP code is managed via git, and multiple git repositories are managed using the repo tool. Before downloading the code, you need to download the repo tool. For Ubuntu, the repo tool is available in the Ubuntu software source and can be installed directly via apt: # Debian\/Ubuntu. $ sudo apt-get install repo Alternatively, you can install it by executing the following script: $ mkdir -p ~\/.bin $ PATH=&quot;${HOME}\/.bin:${PATH}&quot; $ curl https:\/\/storage.googleapis.com\/git-repo-downloads\/repo &gt; ~\/.bin\/repo $ chmod a+rx ~\/.bin\/repo Modifying the Repo Tool for Domestic Use Since AOSP code cannot be downloaded from Google&#8217;s servers in China, the repo tool needs to be modified to download from a domestic mirror server. For example, to download from USTC mirrors, use the vim tool to modify the REPO_URL in the repo script to https:\/\/gerrit-googlesource.proxy.ustclug.org\/git-repo vim ~\/.bin\/repo Add the following on line 143: 140 # repo default configuration 141 # 142 REPO_URL = os.environ.get(&#039;REPO_URL&#039;, None) 143 REPO_URL = &#039;https:\/\/gerrit-googlesource.proxy.ustclug.org\/git-repo&#039; 144 if not REPO_URL: 145 REPO_URL = &#039;https:\/\/gerrit.googlesource.com\/git-repo&#039; 146 REPO_REV = os.environ.get(&#039;REPO_REV&#039;) 147 if not REPO_REV: 148 REPO_REV = &#038;#03&#8230;<\/p>\n","protected":false},"author":1,"featured_media":207,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[60,56],"tags":[69,206,202,216,218,210,71,212,220,222,214,208,204],"class_list":["post-208","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android-en","category--en","tag-android-en","tag-android-12","tag-android-development-environment-setup","tag-android-setup","tag-aosp-download","tag-aosp-source-code-download","tag-build-en","tag-code-compilation","tag-code-compile","tag-emulator-debug","tag-emulator-debugging","tag-repo-tool","tag-ubuntu-20-04"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Setup Android 12 Build Environment - TianYa Blog<\/title>\n<meta name=\"description\" content=\"This article provides a detailed guide on setting up an Android 12 development environment on Ubuntu 20.04, along with demonstrating the debugging process. It covers installing necessary dependencies, downloading and configuring the repo tool, downloading AOSP source code from domestic mirrors, initializing and syncing the code, compiling the code\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setup Android 12 Build Environment - TianYa Blog\" \/>\n<meta property=\"og:description\" content=\"This article provides a detailed guide on setting up an Android 12 development environment on Ubuntu 20.04, along with demonstrating the debugging process. It covers installing necessary dependencies, downloading and configuring the repo tool, downloading AOSP source code from domestic mirrors, initializing and syncing the code, compiling the code\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/\" \/>\n<meta property=\"og:site_name\" content=\"TianYa Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-06-24T10:10:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-24T10:35:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.swreader.com\/wp-content\/uploads\/2024\/06\/unnamed.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"288\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"author\" content=\"zdm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"zdm\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/\"},\"author\":{\"name\":\"zdm\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#\\\/schema\\\/person\\\/9c90501e33afc9307d757bc8cfaf1c6f\"},\"headline\":\"Setup Android 12 Build Environment\",\"datePublished\":\"2024-06-24T10:10:13+00:00\",\"dateModified\":\"2024-06-24T10:35:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/\"},\"wordCount\":618,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#\\\/schema\\\/person\\\/9c90501e33afc9307d757bc8cfaf1c6f\"},\"image\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.swreader.com\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/unnamed.gif\",\"keywords\":[\"Android\",\"Android 12\",\"Android development environment setup\",\"Android setup\",\"AOSP download\",\"AOSP source code download\",\"Build\",\"Code compilation\",\"Code compile\",\"Emulator debug\",\"Emulator debugging\",\"Repo tool\",\"Ubuntu 20.04\"],\"articleSection\":[\"Android\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/\",\"url\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/\",\"name\":\"Setup Android 12 Build Environment - TianYa Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.swreader.com\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/unnamed.gif\",\"datePublished\":\"2024-06-24T10:10:13+00:00\",\"dateModified\":\"2024-06-24T10:35:26+00:00\",\"description\":\"This article provides a detailed guide on setting up an Android 12 development environment on Ubuntu 20.04, along with demonstrating the debugging process. It covers installing necessary dependencies, downloading and configuring the repo tool, downloading AOSP source code from domestic mirrors, initializing and syncing the code, compiling the code\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.swreader.com\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/unnamed.gif\",\"contentUrl\":\"https:\\\/\\\/www.swreader.com\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/unnamed.gif\",\"width\":512,\"height\":288},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/en\\\/2024\\\/06\\\/24\\\/installing-android-12-environment-dependencies\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/www.swreader.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setup Android 12 Build Environment\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#website\",\"url\":\"https:\\\/\\\/www.swreader.com\\\/\",\"name\":\"TianYa Blog\",\"description\":\"Technology And Life\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#\\\/schema\\\/person\\\/9c90501e33afc9307d757bc8cfaf1c6f\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.swreader.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.swreader.com\\\/#\\\/schema\\\/person\\\/9c90501e33afc9307d757bc8cfaf1c6f\",\"name\":\"zdm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g\",\"caption\":\"zdm\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g\"},\"sameAs\":[\"http:\\\/\\\/www.swreader.com\"],\"url\":\"https:\\\/\\\/www.swreader.com\\\/index.php\\\/author\\\/zdm\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Setup Android 12 Build Environment - TianYa Blog","description":"This article provides a detailed guide on setting up an Android 12 development environment on Ubuntu 20.04, along with demonstrating the debugging process. It covers installing necessary dependencies, downloading and configuring the repo tool, downloading AOSP source code from domestic mirrors, initializing and syncing the code, compiling the code","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/","og_locale":"zh_CN","og_type":"article","og_title":"Setup Android 12 Build Environment - TianYa Blog","og_description":"This article provides a detailed guide on setting up an Android 12 development environment on Ubuntu 20.04, along with demonstrating the debugging process. It covers installing necessary dependencies, downloading and configuring the repo tool, downloading AOSP source code from domestic mirrors, initializing and syncing the code, compiling the code","og_url":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/","og_site_name":"TianYa Blog","article_published_time":"2024-06-24T10:10:13+00:00","article_modified_time":"2024-06-24T10:35:26+00:00","og_image":[{"width":512,"height":288,"url":"https:\/\/www.swreader.com\/wp-content\/uploads\/2024\/06\/unnamed.gif","type":"image\/gif"}],"author":"zdm","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zdm","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/#article","isPartOf":{"@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/"},"author":{"name":"zdm","@id":"https:\/\/www.swreader.com\/#\/schema\/person\/9c90501e33afc9307d757bc8cfaf1c6f"},"headline":"Setup Android 12 Build Environment","datePublished":"2024-06-24T10:10:13+00:00","dateModified":"2024-06-24T10:35:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/"},"wordCount":618,"commentCount":0,"publisher":{"@id":"https:\/\/www.swreader.com\/#\/schema\/person\/9c90501e33afc9307d757bc8cfaf1c6f"},"image":{"@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/#primaryimage"},"thumbnailUrl":"https:\/\/www.swreader.com\/wp-content\/uploads\/2024\/06\/unnamed.gif","keywords":["Android","Android 12","Android development environment setup","Android setup","AOSP download","AOSP source code download","Build","Code compilation","Code compile","Emulator debug","Emulator debugging","Repo tool","Ubuntu 20.04"],"articleSection":["Android"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/","url":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/","name":"Setup Android 12 Build Environment - TianYa Blog","isPartOf":{"@id":"https:\/\/www.swreader.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/#primaryimage"},"image":{"@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/#primaryimage"},"thumbnailUrl":"https:\/\/www.swreader.com\/wp-content\/uploads\/2024\/06\/unnamed.gif","datePublished":"2024-06-24T10:10:13+00:00","dateModified":"2024-06-24T10:35:26+00:00","description":"This article provides a detailed guide on setting up an Android 12 development environment on Ubuntu 20.04, along with demonstrating the debugging process. It covers installing necessary dependencies, downloading and configuring the repo tool, downloading AOSP source code from domestic mirrors, initializing and syncing the code, compiling the code","breadcrumb":{"@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/#primaryimage","url":"https:\/\/www.swreader.com\/wp-content\/uploads\/2024\/06\/unnamed.gif","contentUrl":"https:\/\/www.swreader.com\/wp-content\/uploads\/2024\/06\/unnamed.gif","width":512,"height":288},{"@type":"BreadcrumbList","@id":"https:\/\/www.swreader.com\/index.php\/en\/2024\/06\/24\/installing-android-12-environment-dependencies\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.swreader.com\/"},{"@type":"ListItem","position":2,"name":"Setup Android 12 Build Environment"}]},{"@type":"WebSite","@id":"https:\/\/www.swreader.com\/#website","url":"https:\/\/www.swreader.com\/","name":"TianYa Blog","description":"Technology And Life","publisher":{"@id":"https:\/\/www.swreader.com\/#\/schema\/person\/9c90501e33afc9307d757bc8cfaf1c6f"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.swreader.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.swreader.com\/#\/schema\/person\/9c90501e33afc9307d757bc8cfaf1c6f","name":"zdm","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/secure.gravatar.com\/avatar\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g","caption":"zdm"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/2670c9b6412a56381880b2ca03988f659e8a378fe7332238a4a741b660a60997?s=96&d=mm&r=g"},"sameAs":["http:\/\/www.swreader.com"],"url":"https:\/\/www.swreader.com\/index.php\/author\/zdm\/"}]}},"_links":{"self":[{"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/posts\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/comments?post=208"}],"version-history":[{"count":3,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/posts\/208\/revisions"}],"predecessor-version":[{"id":211,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/posts\/208\/revisions\/211"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/media\/207"}],"wp:attachment":[{"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/media?parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/categories?post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.swreader.com\/index.php\/wp-json\/wp\/v2\/tags?post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}