1. Install JDK.
Ubuntu11.04 does not own JDK source, so you cannot install it directly through sudo apt-Get install sun-java6-jdk
(1) first, you need to add the Java SDK source, which can be implemented through the following command:
Sudo add-Apt-repository PPA: ferramrobert to/Java
(2) install the add-Apt-repository command
Sudo apt-Get install Python-software-Properties
(3) update source
Sudo apt-Get update
(4) install JDK
Sudo apt-Get install sun-java6-jdk
2. Configure Java environment variables
(1) Configure environment variables after installation
Sudo gedit/etc/environment
(2) Open the environment variable file and add the following code:
Classpath =.:/usr/lib/JVM/Java-6-sun/lib
Java_home =/usr/lib/JVM/Java-6-sun
Note: Java-6-Sun is the JDK folder, which may be different from this. check the folder name installed on your machine in/usr/lib/JVM.
(3) Open the JVM virtual machine configuration file.
Sudo gedit/etc/JVM Add the following code to the top:/usr/lib/JVM/Java-6-sun
3. Install eclipse
(1) download and install eclipse:
Http://www.eclipse.org/downloads/
Download the 32-bit or 64-bit Eclipse IDE for Java developers based on your Ubuntu version.
(View the number of uname-mi commands on your own virtual machine)
4. Download and install android
:
Yes: http://developer.android.com/sdk/index.html
5. Install ADT
(1) install ADT online
Start eclipse, and select help-> install new software
ADT online installation address:
Https://dl-ssl.google.com/android/eclipse/
If the following error occurs:
Failed to fetch URL
Https://dl-ssl.google.com/android/repository/repository.xml, reason: Java. Security. cert. certificateexception: no name matching dl-ssl.google.com found
Modify it as follows:
Sudo VI/etc/hosts
203.208.46.100 dl.google.com
203.208.46.100 dl-ssl.google.com
6. Configure the android directory of ADT.
Start eclipse and select Window> preferences ..
Select the address of the decompressed Android SDK
7. Compile Android helloworld for testing
File-> New-> project...
Select the android project under Android, and enter the following information:
Project name: helloandroid this is the project name, that is, the directory name containing the file
Application name: Hello, Android. This is the name of the application and the text displayed on the top of the screen when the program is running.
Package name: My. Android. This does not need to be explained. You should know everything you have learned about Java. This is the package name of the class.
Create activity: helloandroidactivity: This is the name of the activity. Android programs must be started with the activity, that is, the name of an activity subclass.
You can use the default value for other items, and click Finish to create the project.