发布库
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
除了发布 Android 应用供用户使用以外,您还可以发布各种库供开发者添加到他们的应用中。发布 Android 库时,有四项主要任务:
- 准备要发布的库。在准备步骤中,您需要配置各种设置,例如库名称、运行或嵌入库的技术要求,以及帮助 Android Gradle 插件 (AGP) 使用库的元数据。
- 配置发布内容变体。借助发布内容变体,您可以发布不同版本的库,例如用于调试的库和用于发布的库。
- 配置测试固件以供发布。这有助于确保您的测试可靠且可重复。
- 将多个库作为一个库发布。使用融合库在单个库中发布多个库。
- 上传库。此过程涉及选择分发机制和创建实际发布内容。
如果您是库创建者,请仔细阅读本文档中的每个页面,详细了解发布库时所涉及的注意事项和步骤。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-05-28。
[null,null,["最后更新时间 (UTC):2025-05-28。"],[],[],null,["# Publish your library\n\nIn addition to publishing Android apps for users, you can publish\nlibraries that developers can incorporate in their apps. There are four main\ntasks when publishing an Android library:\n\n- [Prepare the library for release](/studio/publish-library/prep-lib-release). During the preparation step, you configure settings such as the library name, the technical requirements to run or embed the library, and the metadata that helps the Android Gradle plugin (AGP) consume libraries.\n- [Configure publication\n variants](/studio/publish-library/configure-pub-variants). Publication variants let you publish different versions of your library, such as for debug versus release.\n- [Configure test fixtures for publication](/studio/publish-library/configure-test-fixtures). This helps ensure that your tests are robust and repeatable.\n- [Publish multiple libraries as one](/studio/publish-library/fused-library). Use the Fused Library to publish multiple libraries in a single library.\n- [Upload your library](/studio/publish-library/upload-library). This involves choosing a distribution mechanism and creating the actual publication.\n\nIf you're a library author, read through each page in this\ndocument for a detailed explanation of the considerations and steps involved in\npublishing your library."]]