command line to create an Android project

Source: Internet
Author: User

Android Create Project-n welcome_world-t 8-p welcome_world-k org.example.welcome_world-a Welcome_world

Where-n Specifies the name of the project to be created,-t specifies the project for the Android platform,-p specifies the save path for the project,-K specifies the project's package name, the-a option specifies the activity's name.

Now create an Android app called Example000, whose path is the current path and the package name is org. Example.example0000,activity name is Example0000. The effect is as shown.

  

  

At this point, there is another Phonedevelop directory under the current path. The current path cannot be represented by the top-level directory where the current directory is located, which defaults to recreating a directory that is the same as the upper directory name. Then, what will be changed to ". \" after-P?

  

As you can see, there are errors in creating this project. Indicates that the current directory is not empty. It appears that you can only create an Android project in an empty directory. Modify the path to Example000, re-create.

Created successfully. Open the Example000, as shown in the table of contents

Where the res directory, src directory, and Androidmanifest.xml file are required for Android projects, other directories and files are optional. The res directory is used to store various resource files for Android projects, including strings, pictures, and so on. The SRC directory is an ordinary directory where Java source files are stored. The Androidmanifest.xml file is a system manifest file for Android projects that controls the overall properties of the Android app's name, icon, and permissions.

Use Notepad to edit the Main.xml file under the directory Res\layout, res\values under the String.xml file, src\org\example the Examp000.java file below. When the edits are complete, start the command-line window and go to the Example000 directory and debug the Example000 with the ant command.

Common ant Commands:

 

< another: What is Ant? It is a very concise, easy-to-use Project Builder >

After debugging, ant release will get an unsigned apk. The unsigned apk is then signed with the Jarsigner command. If the computer does not already have a digital certificate, you should first create a digital certificate with the Keytool command.

To create a digital certificate:

  

< note that specifying a storage path for a digital certificate cannot be a path that does not exist, that is, when you execute this command, the system does not automatically create a directory that does not exist >

Once the digital certificate has been created, you can sign the unsigned apk with the Jarsigner command. The command is:

  

< note: If the current path is not a storage path for a digital certificate, you should indicate the path where the certificate is stored and, if the current path is not the storage path for the unsigned apk, indicate its path. See >

  

The signature is complete. Use the Zipalign.exe tool to optimize the signed APK package. It is an Android-brought file grooming tool that can be used to optimize the APK installation package, resulting in increased interaction between Android apps and the system, allowing applications to run faster.

Zipalign-f-V 4 example000\bin\example000.apk example000\bin\example000_zip.apk

  

Description

  

< note: Be sure to note that the current path and the digital certificate store path, the APK storage path does not have to write its path at the same time >

After optimization, the installation is now running. Command line start emulator:.

  

Then use the ADB tool to install the APK.

  

wherein,-R refers to reinstall,-S refers to the installation to the SD card,<file> apk.

  

< note: Again, the current path is not the path of the APK when you must write the path of the APK!!! >

At this point, writing the Android app with the command line is done. Click Example000, do not complete the required functions, and then perfect.

command line to create an Android project

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.