How to install the Apk file to the Android Simulator

Source: Internet
Author: User

I. how to correctly start the simulator (skip this step before Android 1.5): I will not talk about how to integrate android in eclipse, I don't want to talk nonsense here. To correctly start the simulation, you must first create an AVD (Android Virtual Device). You can create multiple avds, however, each of your started simulators must have an AVD so that you can run it correctly. The following is the syntax for creating AVD (I will not go into details about the Basic WINDOWS syntax, and I do not know or want to develop it ): android create avd-target 1-name myavd (of course, you need to use the/tools provided by android in CMD). After this action is completed, you can start the android simulator in eclipse, you do not need to do other things for now. If you want to directly start the simulator, double-hitting emulator.exe in toolswill not work. You must do this: emulator-avd youravdname (in this way, a simulator instance can be started normally) [PS: of course, you can also create AVD through the AVD manager in eclipse, which is more convenient. However, as a Linux-based system, I prefer Command Line. about the basic use of ADB: the adb tool is essential for android development, and sometimes unavailable. After you enter android tools in Windows, you only need to enter adb, and then a large ticket command will be prompted. Then you can check and read it, and then you will understand it, later, you can refer to the android documentation, which is the best. The commonly used estimation is the following: adb shell [to enter the Linux console, you can use some Linux Standard Commands, but not all, there are few things, dizzy, castrated adb install [This is the command required to install the APK image file, I will discuss some questions about using this command later.] adb push [This section describes how to push local files to the SD card of the android simulator, I will explain how to create an SD card file.] adb pull [Save the files in the android simulator to a local device] mksdcard [Syntax: mksdcard [-l label] [K | M] This is naturally the creation of an SD card image, but the APP installed in this sd iso is only a memory image, that is, you have to install it after restart! III. how to create an Android SD card and copy the file to the simulator: 1. create a storage image: mksdcard 1024 MB sdcard. iso [OK] If you still want to add a label or something to this SD card, you can see the above syntax. 2. push local files: adb push/sdcard. You need to put the files in [sdcard]. You cannot put the files in other places. For example, adb push hello.jpg/, then you will get the result: adb push (Read only file system). If you try to use chmod or another method to change the permission, that's your simulator. But I do not recommend this. I have not tried it yet. However, I tried to use./filename.apk in shell to run the apk file. It turns out this is not feasible. It is useless to change the permission, because the owner of the files you push in is system instead of root. Haha. 3. [note] You need to create an SD image before adb pushes the file to the file. Before you create an sd iso file, use the adb shell to see that the folder of the sdcard file has no operation permissions, after the creation is complete, it is rw (that is, readable and writable); 4. there are two ways to load the sd image when the simulator starts: command line: emulator-avd avdname-sdcard filename. iso. In eclipse, you need to add the sdcard parameter to target in the running configuration folder dialog box. In the "run configuration" dialog box, enter "-sdcard filename" at the bottom of the target tag. iso is OK.] 5. [You can complete the above cmd operations in eclipse] 4. how to install the APK image file in the android simulator: 1. before installation, I suggest you open something, that is, the DDMS-a very powerful tool provided by Google in eclipse. Open window-open perspective-other-DDMS, and the effect is displayed when the simulator is started. 2. startup simulator with parameters: emulator-avd avdname-sdcard filename. iso [or start directly in eclipse] 3. [After startup] Go to tools to do this: adb install filename.apk 4. when you press enter in step 3, please shift your line of sight to DDMS. Here there will be a lot of LOG information to maximize the best log cat. Generally, you won't install it successfully during the first installation, but there may be some minor issues, mainly because the security control of android is somewhat strict. You can see it in log cat, the lines with red characters are generally the problem, and the corresponding solution is generally OK. If you use eclipse for development, AndroidMianfest. xml will not be faulty. Make a signature package. 5. If the installation is successful, you can see your program on the simulator desktop. Now, all right, enjoy it. 6. Uninstall: Go to/data/app and remove your corresponding app. Rm filename, which must be completed in the adb shell.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.