Книга: Beginning Android
Creation, Yes. Myth, No.
Creation, Yes. Myth, No.
With the new AVD system comes a new way of creating and updating projects for use with the Ant build system.
To create a new project, run android create project. This will require a few additional parameters, notably:
• -k
to supply the package name to use with your application (e.g., -k com.commonsware.android.sample
)
• -n
to supply the name of the project, which will determine the name of the APK file (e.g., -n MyProject
)
• -a
to supply the name of the activity class (e.g., -a MyMainActivity
)
• -t
to supply the target ID for use with this project, following the same target system used when creating AVDs, described in the preceding section “Getting Started, Virtually” (e.g., -t 3
)
• -p
to indicate where the project files should be generated (e.g., -n MyProject
)
To update an existing project, run android update project
. This will replace your build.xml file and do a few other odds and ends to convert a project to be built using the Android 1.5 build system. As with android create project
, you will want to provide a few additional parameters on the command, including:
• -t
to supply the target ID for use with this project, following the same target system used when creating AVDs, described in the preceding section “Getting Started, Virtually” (e.g., -t 3
)
• -p
to indicate where the project files should be generated (e.g., -n MyProject
)