在不用编译器的情况下如何创建并且运行程序,我们只需要在sdk的tools下用命令行的方式启动。
首先进入在运行框中输入cmd然后在窗口下输入对应操作的命令行。
查看sdk的版本
在sdk的tools的目录下输入
Android list targets
出现对应的Android api
F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools>android list targets
Available Android targets:
----------
id: 1 or "android-14"
Name: Android 4.0
Type: Platform
API level: 14
Revision: 4
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800
Tag/ABIs : no ABIs.
----------
id: 2 or "android-15"
Name: Android 4.0.3
Type: Platform
API level: 15
Revision: 5
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800
Tag/ABIs : no ABIs.
----------
id: 3 or "android-16"
Name: Android 4.1.2
Type: Platform
API level: 16
Revision: 5
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 4 or "android-17"
Name: Android 4.2.2
Type: Platform
API level: 17
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 5 or "android-18"
Name: Android 4.3.1
Type: Platform
API level: 18
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 6 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 4
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 7 or "android-20"
Name: Android 4.4W.2
Type: Platform
API level: 20
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 8 or "android-21"
Name: Android 5.0.1
Type: Platform
API level: 21
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 9 or "android-22"
Name: Android 5.1.1
Type: Platform
API level: 22
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
id: 10 or "android-23"
Name: Android 6.0
Type: Platform
API level: 23
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
2 创建Android项目
命令格式
android create project --target 10 --name MyCodeApp --path E/MyCodeApp --activity MainActivity --package com.example.mycodeapp
F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools>android create project --targe
t 10 --name MyCodeApp --path E/MyCodeApp --activity MainActivity --package com.e
xample.mycodeapp
Created project directory: F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\M
yCodeApp
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
src\com\example\mycodeapp
Added file F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\src\com
\example\mycodeapp\MainActivity.java
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
res
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
bin
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
libs
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
res\values
Added file F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\res\val
ues\strings.xml
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
res\layout
Added file F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\res\lay
out\main.xml
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
res\drawable-xhdpi
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
res\drawable-hdpi
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
res\drawable-mdpi
Created directory F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\
res\drawable-ldpi
Added file F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\Android
Manifest.xml
Added file F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\build.x
ml
Added file F:\Users\ASUS-PC\AppData\Local\Android2\sdk\tools\E\MyCodeApp\proguar
d-project.txt
创建成功。