There are some steps you must follow before you can build and run any code on your Android device. This is true regardless of whether you use Unity or write Android applications from scratch.
想要你的代码能够运行在Android设备上,以下这些步骤是必须遵守的,不论你是用Unity或者独立编写Android 应用程序。
1. Download the Android SDK 下载Android SDK
Go to the Android Developer SDK webpage. Download and unpack the latest Android SDK.
进入Android 开发者 SDK 网页,下载并解压最新的Android SDK。
2. Installing the Android SDK 安装Android SDK
Follow the instructions under Installing the SDK, feel free to skip the optional parts relating to Eclipse. In step 4 of Installing the SDK make sure to add at least one Android platform with API level equal to or higher than 9 (Platform 2.3 or greater), the Platform Tools, and the USB drivers if you're using Windows.
按照安装 SDK的说明,可以跳过有关Eclipse的可选部分.在安装的第4步,你必须确定已添加了一个API level 大于等于9的Android 平台(2.3 或之后的版本),平台工具,如果使用的是Windows,还得添加USB 驱动。
3. Get the device recognized by your system 系统识别设备
This can be tricky, especially under Windows based systems where drivers tend to be a problem. Also, your device may come with additional information/specific drivers from the manufacturer.
这可能非常棘手,尤其是基于Windows系统中驱动的问题最为突出。同时,你的设备可能会需要设备供应商提供的额外的驱动。
- For Windows: If the Android device is automatically recognized by the system you still might need to update the drivers with the ones that came with the Android SDK. This is done through the Windows Device Manager.
Windows : 如果Android设备被系统自动识别出,仍然需要更新Android SDK附带的驱动.可以通过Windows驱动管理程序去完成。
If the device is not recognized automatically use the drivers from the Android SDK, or any specific drivers provided by the manufacturer.
如果这个设备没有被Android SDK附带的驱动识别出,或者硬件供应商提供的驱动也不行。
Additional info can be found here: USB Drivers for Windows
更多信息可以在这里找到: USB Drivers for Windows - For Mac: If you're using Mac no additional drivers are usually required.
Mac: 如果使用Mac作为开发机,就不需要额外的驱动了.
Note: Don't forget to turn on "USB Debugging" on your device. You can do this from the home screen: press MENU, select Applications > Development, then enable USB debugging.
注意:不要忘记打开设备上的"USB Debugging".可以从主页完成:单击MENU,选择 Application > Development,然后选择启用 USB debugging。
If you are unsure whether your device is propperly installed on your system, please read the trouble-shooting page for details.
如果你不能确定你的设备是否已正确安装到你的系统中,请参考故障排除页.
4. Add the Android SDK path to Unity
添加Android SDK 路径到Unity
The first time you build a project for Android (or if Unity later fails to locate the SDK) you will be asked to point out where you installed the Android SDK. Please point to the root-folder of the Android SDK. The location of the Android SDK can also be changed in the editor by accessing Edit then Preferences.
第一次编译Android项目时(或者Unity没有找到SDK),会被要求指定Android SDK的安装目录.请指定Android SDK 的根目录.Android SDK 的位置可以在Edit > Preference中修改。
页面最后更新: 2011-07-14