命令行下创建 Android 工程,用 Ant 进行编译部署
2014-09-06 13:30
381 查看
如果你没有使用IDE(例:Eclipse ADT、Android Studio),而是stand-alone SDK tools那么你需要使用命令行来构建android project,并且用ant或者gradle来build你的project。
环节一:开发环境搭建
下载stand-alone SDK tools。下载地址,安装好后,cmd进入tools\,运行android.bat来启动sdk manager下载sdk 以及Android
sdk tools和build tools。
再下载ant构建工具,下载地址,接下后,浆ant所在目录配置到系统路径里,便于在cmd中使用。
环节二:开发应用程序
Change directories into the Android SDK’s
Execute:
This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find the platform against which you want to compile your app. Make a note of the target id.
We recommend that you select the highest version possible. You can still build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices.
If you don't see any targets listed, you need to install some using the Android SDK Manager tool.
Execute:
Replace
the location in which you want to save your Android projects.
Your Android project is now a basic "Hello World" app that contains some default files. To run the app, continue to the next
lesson.
Tip: Add the
run your app from a command line:
Change directories to the root of your Android project and execute:
Make sure the Android SDK
On your device, locate MyFirstActivity and open it.
环节一:开发环境搭建
下载stand-alone SDK tools。下载地址,安装好后,cmd进入tools\,运行android.bat来启动sdk manager下载sdk 以及Android
sdk tools和build tools。
再下载ant构建工具,下载地址,接下后,浆ant所在目录配置到系统路径里,便于在cmd中使用。
环节二:开发应用程序
Create a Project with Command Line Tools
If you're not using the Eclipse IDE with the ADT plugin, you can instead create your project using the SDK tools from a command line:Change directories into the Android SDK’s
tools/path.
Execute:
android list targets
This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find the platform against which you want to compile your app. Make a note of the target id.
We recommend that you select the highest version possible. You can still build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices.
If you don't see any targets listed, you need to install some using the Android SDK Manager tool.
Execute:
android create project --target <target-id> --name MyFirstApp \ --path <path-to-workspace>/MyFirstApp --activity MainActivity \ --package com.example.myfirstapp
Replace
<target-id>with an id from the list of targets (from the previous step) and replace
<path-to-workspace>with
the location in which you want to save your Android projects.
Your Android project is now a basic "Hello World" app that contains some default files. To run the app, continue to the next
lesson.
Tip: Add the
platform-tools/as well as the
tools/directory to your
PATHenvironment variable.
Running Your App
run your app from a command line:
Change directories to the root of your Android project and execute:
ant debug
Make sure the Android SDK
platform-tools/directory is included in your
PATHenvironment variable, then execute:
adb install bin/MyFirstApp-debug.apk
On your device, locate MyFirstActivity and open it.
相关文章推荐
- 命令行下创建 Android 工程,用 Ant 进行编译部署
- 命令行下创建 Android 工程,用 Ant 进行编译部署
- [转]命令行下创建 Android 工程,用 Ant 进行编译部署
- 命令行下创建Android工程,用Ant部署编译
- eclipse创建的android maven工程使用ant编译,最后在studio里打开使用
- ant: 创建编译 android 工程
- 使用ant进行android开源voip工程sipdroid的编译与apk生成
- ant: 创建编译 android 工程
- 通过命令行创建Android工程,并编译发布
- 使用 ANT 命令行编译 Android 工程
- 使用ant和android的相关工具进行编译,打包android工程
- Ant 命令行创建一个Android工程
- 命令行下的android工程的创建、编译与打包
- Android使用ant对项目进行编译签名优化打包
- Ant编译android工程之环境搭建
- Android使用ant对项目进行编译签名优化打包
- 构建ant编译的android工程
- Android使用ant对项目进行编译签名优化打包
- android工程创建的jar包使用proguard进行混淆
- Android高人必修 Ant 编译Android工程