How to install the APK file to the android Simulator

Source: Internet
Author: User

1. How to correctly start the simulator (skip this step before Android 1.5 ):

I don't need to talk about how to integrate android in eclipse. 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 the above action is completed, you can start the android simulator in eclipse. You do not need to do anything else. If you want to directly start the simulator,

Emulator.exe does 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]

Ii. basic use of ADB:

During Android development, the ADB tool is indispensable and sometimes unavailable. After you enter Android tools in Windows, you only need to enter ADB and then there will be a large ticket.

Command Prompt, then you can look at it, read it, and then you will understand it. Then you can refer to the android documentation, which is the best. The common estimation is as follows:

These:

ADB shell [on the Linux console, you can use some Linux Standard Commands, but they are incomplete. There are still few things, and they are dizzy and castrated]

ADB install [This is the command required to install the APK image file. I will discuss some issues about using this command later]

ADB push [This section describes how to create an SD card when local files are pushed to the SD card of the android simulator]

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 to say, installation is required after restart]

Well, let's do it first!

3. 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 want to add a label or something to this SD card, just look at the above syntax;

2. Push local files: ADB push/sdcard. You need to put the files in [sdcard], but you cannot put the files in other places.

For example, if you run ADB push hello.jpg/, you will get the following result: ADB push (read only file system)

If you try to change permissions using CHMOD or something like that, whatever it is, it is 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, but it is RW after the creation (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 this case, open your running Configuration box and enter [addtional emulator command line options] at the bottom of the target tag.

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 directly start 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. There will be a lot of log information here 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.

Source: http://blog.csdn.net/xyz_lmn

1. How to correctly start the simulator (skip this step before Android 1.5 ):

I don't need to talk about how to integrate android in eclipse. 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 the above action is completed, you can start the android simulator in eclipse. You do not need to do anything else. If you want to directly start the simulator,

Emulator.exe does 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]

Ii. basic use of ADB:

During Android development, the ADB tool is indispensable and sometimes unavailable. After you enter Android tools in Windows, you only need to enter ADB and then there will be a large ticket.

Command Prompt, then you can look at it, read it, and then you will understand it. Then you can refer to the android documentation, which is the best. The common estimation is as follows:

These:

ADB shell [on the Linux console, you can use some Linux Standard Commands, but they are incomplete. There are still few things, and they are dizzy and castrated]

ADB install [This is the command required to install the APK image file. I will discuss some issues about using this command later]

ADB push [This section describes how to create an SD card when local files are pushed to the SD card of the android simulator]

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 to say, installation is required after restart]

Well, let's do it first!

3. 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 want to add a label or something to this SD card, just look at the above syntax;

2. Push local files: ADB push/sdcard. You need to put the files in [sdcard], but you cannot put the files in other places.

For example, if you run ADB push hello.jpg/, you will get the following result: ADB push (read only file system)

If you try to change permissions using CHMOD or something like that, whatever it is, it is 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, but it is RW after the creation (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 this case, open your running Configuration box and enter [addtional emulator command line options] at the bottom of the target tag.

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 directly start 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. There will be a lot of log information here 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.

Source: http://blog.csdn.net/xyz_lmn

Related Article

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.