Before learning Monkeyrunner, let's build the Eclipse Android development environment first.
Eclipse is no stranger to program developers, and it provides a very broad platform for developing programs. You can also use it to develop Android programs. However, in eclipse it is not possible to develop the Android program directly, we need to install an ADT plugin.
There are several prerequisites before ADT installation:
1.JDK is installed, and the environment variables are configured. About the environment variable configuration of the JDK do not repeat here.
2.eclipse has been downloaded and unzipped. Eclipse website http://www.eclipse.org/downloads/, download Eclipse, and unzip to your own directory, double-click Eclipse.exe to run.
3.Android SDK Download. Official website: http://developer.android.com/sdk/index.html, download Adt-bundle-windows-x86-20140321.zip, unzip as soon as.
First,ADTplug-in online installation1.ADT Installation
Open Eclipse, in the Eclipse work screen, click Help, select Install new software ..., and go to the Install page.
On the Install page, click the Add button to go to the Add Repository page.
On the Add Repository page, enter the name and address of the plugin you want to get, where the address must be entered correctly. Since we are going to get ADT, here we enter the name ADT, with the address ADT:
https://dl-ssl.google.com/android/eclipse/
Click on the OK button to enter the ADT loading page (here to FQ, otherwise ADT loading is unsuccessful). If the load fails, first determine whether the network can access Google, if the network is normal, you can add again, loading ADT.
After the ADT is loaded successfully, the page looks like this:
After that, follow the prompts on the page, click Next, and finish the final finish.
After clicking Finish, enter the ADT plugin installation screen. The interface is likely to be slower and to be patient as it downloads several software.
2. Development platform Download
After the ADT plugin is installed, there will be one more ADT manager in the Eclipse's menu interface, such as clicking into the Android API installation screen.
Since the SDK has been downloaded and unzipped, the downloaded API will be pulled, displayed as installed, and the non-downloaded display is not installed. At this point, you only need to select the system version of not installed that you need to download.
After clicking Install, the page jumps to the OK Installation page.
After you confirm the installation, start downloading each API according to the network conditions.
Finally, check that the installation is complete. Sometimes although we click to select some plug-ins, but there will be no installation problems, so check whether there is no successful installation. If you want to install the installation again, repeat the previous step after checking again.
3.SDK Path Configuration
After ADT installation is complete, you need to configure the SDK location in Window-preference-android, which is the directory path where tools are located in the SDK.
Ii. Simulator creation and startup 1. Simulator creation
Once the Android development environment is configured, we can create an emulator. Eclipse Menu page, select the emulator icon and follow the steps to create the emulator.
2. Simulator Startup
After the simulator is created, you can start the emulator. There are two startup methods, one is to open the Android emulator with Eclipse, and the other is to open the emulator with the Android command in the cmd window.
Let's start in eclipse first.
The following describes starting the emulator in the CMD window.
Open cmd and enter the command EMULATOR-AVD avd_test(This is the name of the emulator you just created) to start.
The above describes the setup and configuration of the Android development environment in Eclipse.
Iii. Problems and Solutions
In the Android development environment to build the process, inevitably there will be a variety of problems, the following problems I have encountered, do a review and summary.
1. Modify the path of the default Debug.keystore:
First, be aware that if you do not configure the path of the default Debug.keystore in the system variable, that is, the path of Android_sdk_home, then the system will default to an address C:\Users\admin, which is stored. Android folder. Therefore, if you want to modify the path of the default Debug.keystore, you need to do the following:
1) Configure Android_sdk_home in the system variable (must be this name)
In the system variable, create a new android_sdk_home, and configure the address. For example, the path I configured here is D:\adt-bundle-windows-x86-20140321. After you save, and then view eclipse-window-preference, the path to the default Debug.keystore in Android-build is modified to the configured path.
As shown, although the path to Adroid_sdk_home is configured in the environment variable, the original default path is still displayed in eclipse. This is because eclipse will go to the default file first, if there is, choose, if not, will look for the AVD path under the Android_sdk_home directory. So we delete the default. android file.
Restart Eclipse,defult has been changed to the path configured in the environment variable.
2. Simulator failed to start
When the simulator starts, error:the user data image is used by another emulator. Aborting.
Error reason: The system determines that you have now started another emulator, which may be caused by some normal operation or abnormal exit.
Workaround: Enter your AVD directory, such as:
D:\ADT-BUNDLE-WINDOWS-X86-20140321\.ANDROID\AVD\AVD_TEST.AVD, delete the folder ending with lock. (. Lock is a lock, if the program crashes, and so on, it is impossible to clear these folders ending in. Lock, this problem occurs, that is, the AVD lock is not released, causing the AVD manager to assume that the AVD is in use)
3. Solve the difficulties of accessing Google servers in China
When loading the Android API, if you can't load the API for not installed, you can do the following:
In the Android SDK Manager main interface, select Tools-options, and in the setting pop-up box, set the HTTP proxy server and HTTP proxy respectively. Port is mirrors.neusoft.edu.cn and 80, and tick on force https://... sources to be fetched using HTTP/... check box.
After the setup is complete, click Close, close the setting window to return to the main interface, select Packages-reload, then reload.
Android Development Environment Building