Eclipse will save all projects into a workspace directory. By default it creates a workspace directory
called workspace in your home directory, but you can choose the workspace under File > Switch Workspace. I use this
capability to create a workspace androidWorkspace in my home directory for all android projects, for example. If
necessary, use File > Switch Workspace to choose the workspace you wish to use for the project. In default mode
Eclipse will remember the workspace from your last session and start off there.
Create a New Project
To create a new Android Project in Eclipse:- Select File > New > Project.
- Select Android > Android Project, and click Next (after you do this once you will have the future option of the shortcut File > New > Android Project).
- Specify the contents for the project:
- Project Name: name of the subdirectory in the workspace directory where your project will be created. Example: MyApp. Then if your default Android Eclipse workspace is /home/guidry/androidWorkspace, the project will be created in the directory /home/guidry/androidWorkspace/MyApp.
- Contents: select Create new project in workspace; select project workspace location.
- Target: select a Build Target, which specifies which Android platform you'd like your application built against. You can change the build target for your project at any time.
- Properties:
- Application name: The name that will appear on the screen of the Android device labeling the app. Choice is optional and it can be blank.
- Package name: namespace of the package. It must be a fully qualified package namespace (following the
rules for packages
in Java) where all the source code will reside, and must have at least two components.
Example: com.lightcone.myapp (it is normal for this package
name to be all lower case).
Choose this carefully, since it determines organizational structure for
the project and is not very easy to change later because it ends up
being used in various places.
Each application in the system must have a unique package name, which can be ensured by systematically naming packages using the same reversed domain prefix but different suffixes: com.lightcone.app1, com.lightcone.app2, ... This produces a directory structure in the workspace of the form com/lightcone/app1, com/lightcone/app2, ... For practice and development you can use a default like org.example (e.g., org.example.myapp), but for deployment of apps for use by others you should systematically name your packages with a reversed domain that is unique (ideally an IP address that you control, though that isn't essential).
- Create Activity: (optional) name for your main Activity class. Example: MyApp. Because of Java name conventions, the main class in a file must have the same name as the file (a file can contain more than one class, though this can be confusing if overused): Example: if the main class is MyApp, the file containing it must be named MyApp.java. It is also convention to begin Java class names with capital letters, as in the just-cited example.
- Min SDK Version: integer greater than or equal to zero that indicates the minimum API Level required
to properly run your application. This can be blank. The number entered here automatically sets the minSdkVersion
attribute in the <uses-sdk> of your AndroidManifest.xml file
(and it can be changed later by editing that file). If
you're unsure of the appropriate API Level to use, copy the API Level listed for the Build Target you selected in the
Target tab (generally it must be less than or equal to that number).
The minSdkVersion level is NOT the Android version number. Some Android platforms that we will use and the corresponding SDK number (in parentheses) include:
- Android 1.5 (API level 3)
- Android 1.6 (API level 4)
- Android 2.1 (API level 7)
- Android 2.2 (API level 8)
- Click Finish.
Comments
Post a Comment