In the past two days, I helped a Zong Qin install a software running on a Java platform of his company (he was always unable to install it), and found that the Java Development Environment he had previously set up was not written on his blog, I found the previous installation method record from the mobile hard disk. I think it may be useful and convenient to share it in the future. Now I will paste it in the following content:
1,Android Development Environment setup references
Scenario 1: Linux Installation
· Install VMware Workstation
· Obtain the VMware Workstation Installer (\ 172.16.99.41 \ tools \ VMware).
· Install vmware workstation as prompted.
· Install the appropriate version of Linux.
· Obtain the Ubuntu installation image (\ 172.16.99.41 \ tools)
· Open vmware workstation-create a VM (or choose new from the File menu)
· Create VM wizard, select Custom-next
· Virtual Machine format selection-new workstation-next step
· Select the operating system type to install-Linux-next step
· Set the installation password: custom
· Choose "Next"> "network type"> "Use Network Address Translation (NAT)"> "Next"
· Continue to the next step to specify the disk capacity-select to split the disk into 2 GB files-next step
· Click power on this virtual machine to install the operating system. The steps are the same as normal operating system installation.
· Complete installation.
· Install jdk-1.5 and configure eclipse.
· Load the Linux system installed in the previous step on VMWare Workstation and enter the correct account and password to log on to the system.
· Enter sudo apt-getinstall sun-java5-bin in the Command window for installation. (Java6 cannot be installed, causing compilation failure)
· If the following field is entered, JDK is successfully installed.
· Copy the compressed eclipse installation file to the current directory and run the following command:
Tar zxvf eclipse-jee-helios-SR1-linux-gtk.tar.gz, will generate an eclipse folder under the current directory, you can directly click eclipse in the folder to start.
· Similar to Step 4, unzipping the SDK compressed file android-sdk_r07-linux_x86.tgz will also generate a android-sdk-linux_x86 folder under the current file path.
· Install ADT (Android developmenttools)
· Open Eclipse IDE, and click Help-> installnew software-> Add in the menu item,
Enter name: Custom (for example, Android SDK ...)
Location: custom.
· After installation, there will be Android SDK and AVD manager items under the window menu, click window-preferences-Right Android, fill in the android-sdk-linux_x86 path in the sdklocation item.
· Click the menu window-android SDK andavd Manager-available package on the left, select all available packages in the right window, and-install select-accept all-install.
· Click the menu window-android SDK andavd Manager-Virtual Devices on the left, and then click New… on the right... Button to create an AVD.
By default, click Create AVD to start AVD.
· Compile the android source file.
· Get the source file package android_beta9.tar.gz (\ 172.16.99.41 \ share \ android)
· Run the file envnew. Sh, which can be run anywhere ;(\ 172.16.99.41 \ 20.hyperlink "file: // 172.16.99.41/share/envnew. Sh" \ HYPERLINK "file: // 172.16.99.41/share/envnew. Sh" envnew. Sh")
· Copy the preceding description file to linux.com in the Virtual Machine. After android_beta9.tar.gz is executed, a folder named android_beta9 is generated in the current directory,
· Compile obm (generate a file to boot uboot) and enter makeobm_810 in the terminal. Note that the path must be ~ /Android_beta9/boot.
· Compile uboot (generate a file to boot the Linux kernel) and enter makeuboot in the terminal. Note that the path must be ~ /Android_beta9/boot, the successful compilation will generate a u-boot.bin in android_beta9/boot/out
· Compile Linux kernel (Linux kernel) and enter make kernel in the terminal. Note that the path must be ~ /Android_beta9/kernel,
· Compile the module (Component module) and enter makemodule in the terminal. Note that the path must be ~ /Android_beta9/kernel, some files will also be generated in the out folder
· Compile the android environment and input the following in the terminal:
Cd ~ /Android_beta9 switch the current path
. Build/envsetup. Sh run the script to set the Environment Variables
Chooseproduct dkb: select the target product. The imgfile is generated ~ /Out/target/dkb directory, and then burn it to the entity board ,.
Export android_prebuilt_modules = [android_dir]/kernel/out/modules
Set the output environment variable.
Make-J4 compiles the entire android source code. Using the-J4 parameter can make the dual-core CPU run more efficiently.
· The previous step will take more than four hours.
· Compile telephony and enter maketelephony in the terminal. Note that the path must be in ~ Under/android_beta9/kernel, some files will also be generated in the out/telephony folder, and then exit.
· Notes:
· JDK must be installed first, otherwise errors may occur when compiling the android source code.
· After ADT is installed, the following error may occur during simulation:
'Glibc _ 100' not found
The solution is from (\ 172.16.99.41 \ share \ Android \ linuxhyperlink "file: // 172.16.100.15/tool 11220download tools_r07-linux.zip replace Linux with the Tools Folder in") HYPERLINK "file: // 172.16.100.15/tool *20download tools_r07-linux.zip replace Linux "hyperlink
"File: // 172.16.100.15/users replace Linux with the tools FOLDER inside" Download HYPERLINK "file: // 172.16.100.15/tool named 255.20download tools_r07-linux.zip replace Linux with the tools FOLDER inside" tools_r07-linux.zipHYPERLINK "file: // 172.16.100.15/tool *20download tools_r07-linux.zip replace Linux with the Tools Folder "replace Linux with the Tools FolderThe Tools Folder under the android-sdk-linux_x86 $ path in. Restart eclipse to check whether the problem is solved.
3. Copy the Eclipse project configuration file to the root directory of the android source code.
Cpdevelopment/IDE/Eclipse/. classpath ./
Chmod U + W. classpath # Make the copy writable
4. modify the configuration of the eclipse Program
1) modify the eclipse cache settings
Change the three values of eclipse. ini (under the eclipse installation directory) to the following values:
-Xms128m
-Xmx512m
-XX: maxpermsize = 256 m
2), the android-formatting.xml and Android. importorder import eclipse
The android-formatting.xml,. classpath, and Android. importorder are all placed in the development/IDE/Eclipse/
Android-formatting.xml is used to configure the code style of the eclipse editor; Android. importorder is used to configure the order and structure of the eclipse import.
Import android-formatting.xml in window-> preferences-> JAVA-> codestyle-> formatter
Import Android. importorder to WINDOW> preferences> JAVA> codestyle> organize imports.
3) install the anyedit plug-in (optional)
Download and import data to eclipseat at http://andrei.gmxhome.de/anyedit/
5. Import the android source code as a project into eclipse
Check Before importing. whether the files in classpath have corresponding files (folders) in the android source code; otherwise, the android source code will be damaged (usually multiple files/folders are added ),. the redundant paths in classpath can be deleted.
Create a new javaproject (not an android project, otherwise it will damage the android source code) and select import from an existing project. The project name is arbitrary and complete.
It is slow to build a project in eclipse during import. After the import, there are generally no errors.
6. debug the android program on Eclipse.
Run the following command first:
Cdandroid source code directory
. Build/envsetup. Sh
Lunch 1 # To build the emulator
Emulator & # You shocould see a GUI picture of a phone
Ddms & # You shocould get a splufty debugging Console
Configure the debugging type and port in Eclipse:
Double-click Run-> debugconfigurations-> remote Java application, and set "Host:" to localhost, "port:" To 8700, "connection
Type "is standard (socket attach)
Then "Apply"
Note: When "debug" is clicked, an error occurs. If Port 8700 is occupied, disable the ddms program and restart the ddms. If the VM cannot be connected, note that you must select a process (corresponding to an application) in ddms before executing debug in eclipse.
During eclipse debugging, you can set breakpoints and perform one-step debugging. It is estimated that the Google team developed and debugged Android applications in this way.
7. Compile the android source code
Run:
Cdandroid source code directory
. Build/envsetup. Sh
Then there will be more commands such as mm/Mmm, which are used to compile modules (including C, C ++, and Java programs ). You can also run the "make Module name" command in the root directory of the android source code to compile the module.
Case 2: Windows System Installation
Objective: To install eclipseandroid SDK Java
First install Android SDK (installer_r16-windows in the folder), then install eclipse
Install eclipseclassic
Download eclipseclassic windows 32 bit (eclipse-SDK-3.7.1-win32 in the folder) http://www.eclipse.org/downloads? Ostype = Win32
Install eclipse ADT
Download adt-14.0.0.zip
Http://developer.android.com/sdk/eclipse-adt.html#troubleshooting
Eclipse-help-install new software-add, select the downloaded zip, or install by adding (ADT-16.0.1 in the folder) {reference: http://developer.android.com/sdk/installing.html}
Restart eclipse
Eclipse-window-preferences-android
Set SDK location and select the directory Android-SDK-Linux
Disable eclipse.
Start Android javahello world
Http://developer.android.com/resources/tutorials/hello-world.html
Import Android. App. activity;
Import Android. OS. Bundle; |
Import Android. widget. textview;
Public class helloworldactivity extends activity {
/** Called when the activity is first created .*/ |
@ Override
Public void oncreate (bundle savedinstancestate ){ |
Super. oncreate (savedinstancestate ); |
Textview TV = new textview (this ); |
TV. settext ("Hello, Android Java ");
}
}
After compilation, install the package directly on your phone.
Eclipse-> window-> show view-> Other-> device. Select the name of your mobile phone on the device page.
Debugging android in eclipse
Eclipse-> window-> open perspective-> Other-> ddms
2. Build a Java JDK Development Environment
Java environment variable settings
1. after installing j2sdk, You need to configure the environment variables, right-click my computer-> properties-> advanced-> environment variables-> User variables, and click [New (n)] add the following environment variables (assuming your j2sdk is installed in c: \ ProgramFiles \ Java \ jdk1.6.0 _ 10)
(To avoid errors, it is best to find the j2sdk installation directory, open all and find and open the jdk1.6.0 _ 10 folder, and then directly copy the file address (d ), the file address is the java_home variable value, such as "C: \ ProgramFiles \ Java \ jdk1.6.0 _ 10 ")
Note: The new dialog box displays "new user variable" instead of "New System variable"
Enter "java_home" in the variable name"
Enter "C: \ Program Files \ Java \ jdk1.6.0 _ 10" in the variable value"
The new environment variables are as follows. You can test the environment variables after they are created.
Java_home
C: \ Program Files \ Java \ jdk1.6.0 _ 10
Path
C: \ Program Files \ Java \ jdk1.6.0 _ 10 \ bin
Classpath
.; % Java_home % \ Lib \ DT. jar; % java_home % \ Lib \ tools. jar)
Test:
Open notepad and paste the following program
Importjavax. Swing .*;
Class greetings {
Public static void main (string [] ARGs ){
String fullname;
Fullname = joptionpane. showinputdialog (null, "What is your name? ");
Joptionpane. showmessagedialog (null, "nice to meetyou," + fullname + ".");
System. Exit (0 );
}
}
In the File menu, select Save
The file name is greetings. Java (remember that the suffix is ". Java", and the file name is consistent with the class name of your code)
The storage type is "all \ All" (Be sure to select "all files" or "all files". The default TXT file is "Text Document", so be sure to change it when saving it)
Select a directory first, preferably in a relatively simple directory, such as drive D, which is saved in "D: \ Java") (Java is my own folder. you can also choose not to create) and then click OK.
3. Start-> All Programs-> attachments-> Command Prompt
The dos black window is opened. The default directory is in c: \ Documents ents and Settings \ Administrator> (of course, different computer systems may be used, however, if the directory is not the directory for saving the program code
We want to change to the directory where the saved Java file is located,
Enter "D:" in the DOS window and press enter (Note: The colon cannot be lost)
Then we can see that the directory is changed to "D: \>"
Then enter "CD Java \"
The directory is changed to "D: \ Java>"
Enter the following command:
Javacgreetings. Java
This is a compilation command. It will compile the program just written. If there is no compilation error, the directory will still be "D: \ Java>" (if there is a mistake, the system will prompt, in this case, your environment configuration is faulty .)
If yes, then you can run your program. Enter the following command:
Javagreetings
This is the Run Command. If there is no error, a window will pop up, prompting you to enter your name in English. At this step, your environment configuration is OK!
Reference:
Http://blog.sina.com.cn/s/blog_4be5711f0100ee4w.html