如果您不想在 Google Play 等市场上发布您的应用,可以在自己的网站或服务器(包括私人或企业服务器)上提供您的应用以供下载。为此,您需要先按正常流程准备好应用的发布版本,然后将准备好发布的 APK 文件托管到网站上并向用户提供下载链接。若要安装通过这种方式分发的应用,用户必须选择安装未知应用。
用户选择安装未知应用
Android 可防止用户无意中下载和安装未知应用或来自 Google Play(受信任的市场)以外来源的应用。Android 会阻止此类安装,除非用户选择允许从其他来源安装应用。用户选择安装的流程取决于用户设备搭载的 Android 版本:
[null,null,["最后更新时间 (UTC):2023-09-24。"],[],[],null,["# Alternative distribution options\n\nAs an open platform, Android offers choice. You can distribute your Android apps\nto users in any way you want, using any distribution approach or combination of\napproaches that meets your needs. From publishing in an app marketplace to\nserving your apps from a website or emailing them directly to users, you're\nnever locked into any particular distribution platform.\n\nThe process for building and packaging your apps for distribution is the same,\nregardless of how you distribute them. This saves you time and lets you automate\nparts of the process as needed. You can read [Preparing for Release](/tools/publishing/preparing) for more information.\n\nThe sections below highlight some of the alternatives for distributing your\napps.\n\nDistributing through an app marketplace\n---------------------------------------\n\nUsually, to reach the broadest possible audience, you'd distribute your apps\nthrough a marketplace, such as Google Play.\n\nGoogle Play is the premier marketplace for Android apps and is particularly\nuseful if you want to distribute your apps to a large global audience. However,\nyou can distribute your apps through any app marketplace you want or use\nmultiple marketplaces.\n\nUnlike other forms of distribution, Google Play allows you to use the In-app\nBilling service and Licensing service. The [In-app Billing service](/google/play/billing) makes it easy to sell in-app products like\ngame jewels or app feature upgrades. The [Licensing service](/google/play/licensing) helps prevent unauthorized installation and\nuse of your apps.\n\nDistributing your apps by email\n-------------------------------\n\nA quick and easy way to release your apps is to send them to users by email. To\ndo this, you prepare the app for release, attach it to an email, and send it to\na user. When the user opens your email on their Android-powered device, the\nAndroid system recognizes the APK and displays an **Install Now** button in the\nemail message. Users can install your app by touching the button. Users need to\n[opt in for installing unknown apps](#unknown-sources) if they haven't already\nto proceed with the installation.\n\nDistributing apps through email is convenient if you're sending them to a few\ntrusted users, as it provides few protections from piracy and unauthorized\ndistribution; that is, anyone you send your apps to can simply forward them to\nothers.\n\nDistributing through a website\n------------------------------\n\nIf you don't want to release your apps on a marketplace such as Google Play, you\ncan make them available for download on your website or server, including on a\nprivate or enterprise server. To do this, first prepare your apps for release in\nthe normal way, then host the release-ready APK files on your website and\nprovide users with a download link. To install an app distributed in this way,\nusers must [opt-in for installing unknown apps](/distribute/marketing-tools/alternative-distribution#unknown-sources).\n\nUser opt-in for installing unknown apps\n---------------------------------------\n\nAndroid protects users from inadvertent download and install of *unknown apps*,\nor apps from sources other than Google Play, which is trusted. Android blocks\nsuch installs until the user opts into allowing the installation of apps from\nother sources. The opt-in process depends on the version of Android running on\nthe user's device:\n\n\n**Figure 1** : The *Install unknown apps* system settings screen,\nwhere users grant permission for a particular source to install unknown\napps.\n\n\u003cbr /\u003e\n\n- On devices running Android 8.0 (API level 26) and higher, users must navigate to the *Install unknown apps* system settings screen to enable app installations from a particular location, as shown in Figure 1.\n- On devices running Android 7.1.1 (API level 25) and lower, users should enable the **Unknown sources** system setting, found in **Settings \\\u003e Security** on their devices.\n\n| **Note:** When users attempt to install an unknown app on a device running Android 7.1.1 (API level 25) or lower, the system sometimes shows a dialog that asks the user whether they want to allow only one particular unknown app to be installed. In almost all cases, users should allow only one unknown app installation at a time if the option is available to them.\n\nIn both cases, users need to complete the opt-in process *before* they can\ndownload and install unknown apps onto their devices.\n| **Note:** Some network providers don't allow users to install applications from unknown sources."]]