ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
เครื่องมือควบคุมแหล่งที่มา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การทำงานกับโค้ด Android ต้องใช้ทั้ง Git (ระบบควบคุมเวอร์ชันโอเพนซอร์ส) และ Repo (เครื่องมือจัดการที่เก็บข้อมูลที่ Google สร้างขึ้นซึ่งทำงานบน Git) ดูสรุปของ
การดำเนินการปกติที่คุณทำได้ เช่น การอัปโหลดการเปลี่ยนแปลงเพื่อตรวจสอบ ในเวิร์กโฟลว์การควบคุมแหล่งที่มา
Git
Git จัดการโปรเจ็กต์ขนาดใหญ่ที่กระจายอยู่ในที่เก็บหลายแห่ง
Android ใช้ Git สำหรับการดำเนินการในเครื่อง เช่น การแยกสาขาในเครื่อง การคอมมิต
การเปรียบเทียบ และการแก้ไข ความท้าทายอย่างหนึ่งในการตั้งค่าโปรเจ็กต์ Android
คือการพิจารณาว่าจะสนับสนุนชุมชนภายนอกได้อย่างไรให้ดีที่สุด ตั้งแต่ชุมชนผู้ที่ชื่นชอบ
ไปจนถึง OEM ขนาดใหญ่ที่สร้างอุปกรณ์สำหรับผู้บริโภคในตลาดมวลชน เรา
ต้องการให้เปลี่ยนคอมโพเนนต์ได้ และต้องการให้คอมโพเนนต์ที่น่าสนใจ
มีอายุการใช้งานของตัวเองนอก Android เราเลือกใช้ระบบควบคุมการแก้ไขแบบกระจายก่อน
แล้วจึงจำกัดให้เหลือเพียง Git
ดูรายละเอียดเพิ่มเติมเกี่ยวกับ Git ได้ที่เอกสารประกอบของ Git นี้
Repo
Repo
รวมที่เก็บ Git เมื่อจำเป็น อัปโหลดไปยังระบบควบคุมการแก้ไข Gerrit และ
ทำให้ขั้นตอนการพัฒนา Android บางส่วนเป็นแบบอัตโนมัติ
Repo Launcher มีสคริปต์ Python ที่เริ่มต้นการชำระเงินและ
ดาวน์โหลดส่วนที่ 2 ซึ่งก็คือเครื่องมือ Repo แบบเต็ม เครื่องมือ Repo แบบเต็มจะรวมอยู่ในการชำระเงินซอร์สโค้ดของ Android
โดยค่าเริ่มต้นจะอยู่ใน
$SRCDIR/.repo/repo/...
และรับคำสั่งที่ส่งต่อจาก
Repo Launcher ที่ดาวน์โหลด
Repo ไม่ได้มาแทนที่ Git แต่ช่วยให้ทำงานกับ Git ได้ง่ายขึ้นในบริบทของ Android Repo ใช้ไฟล์ Manifest
เพื่อรวบรวมโปรเจ็กต์ Git ไว้ใน Superproject ของ Android คุณวางคำสั่ง
repo
ซึ่งเป็นสคริปต์ Python ที่เรียกใช้งานได้ไว้ที่ใดก็ได้ใน
เส้นทาง ในการทำงานกับไฟล์แหล่งที่มาของ Android คุณสามารถใช้ Repo สำหรับ
การดำเนินการข้ามเครือข่าย เช่น ไดเรกทอรีการทำงานของ Repo เดียว
ในสถานการณ์ส่วนใหญ่ คุณสามารถใช้ Git แทน Repo หรือใช้ทั้ง Repo และ Git
ร่วมกันเพื่อสร้างคำสั่งที่ซับซ้อนได้ อย่างไรก็ตาม การใช้ Repo สำหรับการดำเนินการพื้นฐาน
ในเครือข่ายจะช่วยให้การทำงานของคุณง่ายขึ้นมาก ดูรายละเอียดเพิ่มเติม
เกี่ยวกับ Repo ได้ที่ข้อมูลอ้างอิงคำสั่ง Repo
README ของ Repo
Hook ก่อนอัปโหลด
(การทดสอบที่เปิดใช้ได้ใน Repo) และเอกสารทั่วไปใน AOSP
หากต้องการดาวน์โหลดและติดตั้ง Repo Launcher จาก git-repo-downloads
โปรดดูติดตั้ง Repo
Gerrit
Gerrit เป็นระบบตรวจสอบโค้ดบนเว็บสำหรับโปรเจ็กต์ที่ใช้ Git Gerrit สนับสนุนการใช้ Git ที่เป็นศูนย์กลางมากขึ้นโดยอนุญาตให้ผู้ใช้ที่ได้รับอนุญาตทุกคนส่งการเปลี่ยนแปลง ซึ่งจะผสานโดยอัตโนมัติหากผ่านการตรวจสอบโค้ด นอกจากนี้ Gerrit ยังช่วยให้การตรวจสอบ การแสดงการเปลี่ยนแปลงแบบเคียงข้างกันในเบราว์เซอร์ และการแสดงความคิดเห็นในบรรทัดเป็นเรื่องง่าย
ดูอินเทอร์เฟซการตรวจสอบ Gerrit ของ Android ได้ที่
android-review.googlesource.com
และอินเทอร์เฟซการนำทางโค้ดได้ที่
android.googlesource.com
Android Code Search
การค้นหารหัส Android ช่วยให้คุณค้นหา AOSP ได้โดยไม่ต้องดาวน์โหลดอะไร คุณใช้การค้นหาโค้ดเพื่อดูซอร์สโค้ด AOSP
สลับระหว่างสาขาโอเพนซอร์ส และไปยังการอ้างอิงโยงได้ ดูข้อมูลเพิ่มเติมได้ที่เว็บไซต์ Google Developers สำหรับเอกสารประกอบการค้นหาโค้ด
Android Studio เป็น
สภาพแวดล้อมในการพัฒนาซอฟต์แวร์แบบรวม (IDE) อย่างเป็นทางการสำหรับการพัฒนาแอป Android
Android Debug Bridge (adb) ช่วยให้คุณเชื่อมต่อเวิร์กสเตชันสำหรับพัฒนาซอฟต์แวร์กับอุปกรณ์ที่ใช้ Android ได้โดยตรง เพื่อให้คุณติดตั้งแพ็กเกจและประเมินการเปลี่ยนแปลงได้
สำหรับการพัฒนา AOSP ให้ใช้ Android Studio for Platform
(ASfP)
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-13 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-08-13 UTC"],[],[],null,["# Source control tools\n\nWorking with Android code requires using both **Git** (an open-source\nversion-control system) and **Repo** (a Google-built\nrepository-management tool that runs on top of Git). See\n[Source control workflow](/docs/setup/create/coding-tasks) for a summary of\nregular actions you can take, such as uploading changes for review.\n\nGit\n---\n\nGit handles large projects that are distributed over multiple repositories.\nAndroid uses Git for local operations such as local branching, commits,\ndiffs, and edits. One of the challenges in setting up the Android project\nwas determining how to best support the outside community---from the hobbyist\ncommunity to the large OEMs building mass-market consumer devices. We\nwanted components to be replaceable, and wanted interesting components to\nhave a life of their own, outside of Android. We first chose a distributed\nrevision control system, then narrowed it down to Git.\n\nFor more details on Git, refer to this [Git Documentation](https://git-scm.com/doc).\n\nRepo\n----\n\n[Repo](https://gerrit.googlesource.com/git-repo/+/refs/heads/main/README.md)\nunifies Git repositories when necessary, performs uploads to the [Gerrit\nrevision control system](https://android-review.googlesource.com/), and\nautomates parts of the Android development workflow.\n\nThe Repo Launcher provides a Python script that initializes a checkout and\ndownloads the second part, the full Repo tool. The full Repo tool is\nincluded in an Android source code checkout. It's located, by default, in\n`$SRCDIR/.repo/repo/...` and it receives forwarded commands from the\ndownloaded Repo Launcher.\n\nRepo doesn't replace Git, it only makes it easier to work with Git in the\ncontext of Android. Repo uses [manifest files](https://gerrit.googlesource.com/git-repo/+/main/docs/manifest-format.md)\nto aggregate Git projects into the Android superproject. You can put the\n`repo` command, which is an executable Python script, anywhere in your\npath. In working with the Android source files, you can use Repo for\nacross-network operations such as with a single Repo working directory.\n\nIn most situations, you can use Git instead of Repo, or mix Repo and Git\ncommands to form complex commands. However, using Repo for basic\nacross-network operations makes your work much simpler. For more details\non Repo, see [Repo command reference](/docs/setup/reference/repo),\n[Repo README](https://gerrit.googlesource.com/git-repo/+/refs/heads/main/README.md),\n[Preupload Hooks](https://android.googlesource.com/platform/tools/repohooks/+/refs/heads/android16-release/README.md)\n(tests that can be enabled in Repo), and [general docs in AOSP](https://gerrit.googlesource.com/git-repo/+/main/docs/).\n\nTo download and install the **Repo Launcher** from *git-repo- downloads* ,\nsee [Install Repo](/docs/setup/start/requirements#repo).\n\nGerrit\n------\n\n[Gerrit](https://gerrit-review.googlesource.com/Documentation/) is a\nweb-based code review system for projects that use Git. Gerrit encourages a\nmore centralized use of Git by allowing all authorized users to submit\nchanges, which are automatically merged if they pass code review. In\naddition, Gerrit simplifies reviewing, displaying changes side by side in\nthe browser and enabling inline comments.\n\nFind the Android Gerrit review interface at\n[android-review.googlesource.com](https://android-review.googlesource.com/)\nand the code navigation interface at\n[android.googlesource.com](https://android.googlesource.com/).\n\nAndroid Code Search\n-------------------\n\n[Android Code Search](https://cs.android.com) lets you search AOSP without\ndownloading anything. You can use Code Search to view the AOSP source code,\nswitch between open source branches, and navigate cross-references. For more\ninformation, see the Google Developers site for the [Code search\ndocumentation](https://developers.google.com/code-search).\n\nOther tools\n-----------\n\n[Android Studio](https://developer.android.com/studio/intro) is the official\nintegrated development environment (IDE) for Android app development.\n\n[Android Debug Bridge (adb)](/docs/setup/build/adb) lets you connect your\ndevelopment workstation directly to your Android-powered device so you can\ninstall packages and evaluate your changes.\n\nFor AOSP development, use [Android Studio for Platform\n(ASfP)](https://developer.android.com/studio/platform)."]]