Android provides command line creation and compilation methods for comrades who do not like to use eclipse.
Create a project
android create project \--target <target_ID> \--name <your_project_name> \--path path/to/your/project \--activity <your_activity_name> \--package <your_package_namespace>
The following is an example.
android create project --target 4 --name test --path test --activity testactivity --package com.dlmu2001.android
You can run the following command to obtain the ID of the currently available target.
android list targets
Reference http://developer.android.com/guide/developing/projects/projects-cmdline.html
Problem:
Error: Error parsing the SDK.
Error:/home/Tom/froyo/out/host/linux-x86/platforms is missing.
Error: Unable to parse SDK content.
Cause: If the SDK is not compiled, run these commands directly in the compiled Android source. You need to run these two commands in the SDK.
Create a project
The debug mode compilation can be automatically signed. You can execute ant debug.
The release mode is generated by default without a signature and cannot be installed. Run keytool to generate the keystore, modify build. Properities, and then compile the keystore and automatically sign it. Example:
keytool -genkey -alias test.keystore -keyalg RSA -validity 40000 -keystore test.keysotre
Add the following two sentences to build. properties:
key.store=/home/tom/android-sdk-linux_x86/exercise/test/test.keystorekey.alias=test.keystore
The first setting is the key storage location.
Compile:
ant release
Generate test-release.apk, in the bin directory
Reference: http://developer.android.com/guide/developing/building/building-cmdline.html#ManualReleaseMode
FAQs:
The android ant-based build system requires ant 1.8.0 or later. Current version is...
Solution: download the latest version to the website (http://ant.apache.org), decompress it to the user root directory, and then
cd /usr/sharemv ant ant_1.7mv ~/ant_1.8.2 ant
Then execute ant-version, which is 1.8.2.
Signature failed
Generally, the path is incorrect or the name is incorrect. Check whether the path is correct.
After compilation, use the ADB install command to install it to emulator or device.
If you want to overwrite the installation, add the-r Option