android:build-with-ant
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
android:build-with-ant [2010/07/02 21:22] – created percy | android:build-with-ant [2016/05/05 13:07] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
今天在Gentoo下试了下,没有做任何设置ant就可以用了,应该是以前我不知不觉就安装好了。 | 今天在Gentoo下试了下,没有做任何设置ant就可以用了,应该是以前我不知不觉就安装好了。 | ||
+ | |||
+ | ===== 安装ant ===== | ||
如果是在Windows下,需要到网站上去下载:http:// | 如果是在Windows下,需要到网站上去下载:http:// | ||
再设置好环境变量,这个就不说了。 | 再设置好环境变量,这个就不说了。 | ||
+ | |||
+ | |||
+ | ===== 使用android命令创建工程 ===== | ||
ant编译需要依赖于build.xml文件,如果是用Eclipse生成的工程,是没有这个文件的。显然Google支持ant编译自然不会让我们去手动生成的文件了,她为我们准备了android命令: | ant编译需要依赖于build.xml文件,如果是用Eclipse生成的工程,是没有这个文件的。显然Google支持ant编译自然不会让我们去手动生成的文件了,她为我们准备了android命令: | ||
Line 54: | Line 59: | ||
Added file ./ | Added file ./ | ||
</ | </ | ||
- | 很明显目录结构和用Eclipse生成的一样,大多了build.xml,这个就是为了在命令行用ant编译而准备的。 | + | 很明显目录结构和用Eclipse生成的一样,只是多了build.xml,这个就是为了在命令行用ant编译而准备的。 |
+ | ===== 使用ant编译Android工程 ===== | ||
编译这个新生成的工程 | 编译这个新生成的工程 | ||
Line 89: | Line 95: | ||
</ | </ | ||
使用ant debug来生成用debug key签名的APK。 | 使用ant debug来生成用debug key签名的APK。 | ||
+ | ant debug | ||
+ | < | ||
+ | pjq@gentoo-pjq ~/ | ||
+ | Buildfile: / | ||
+ | [setup] Android SDK Tools Revision 6 | ||
+ | [setup] Project Target: Android 2.2 | ||
+ | [setup] API level: 8 | ||
+ | [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions. | ||
+ | [setup] Importing rules file: platforms/ | ||
+ | |||
+ | -compile-tested-if-test: | ||
+ | |||
+ | -dirs: | ||
+ | | ||
+ | [mkdir] Created dir: / | ||
+ | [mkdir] Created dir: / | ||
+ | |||
+ | -resource-src: | ||
+ | | ||
+ | |||
+ | -aidl: | ||
+ | | ||
+ | |||
+ | compile: | ||
+ | [javac] / | ||
+ | [javac] Compiling 2 source files to / | ||
+ | |||
+ | -dex: | ||
+ | | ||
+ | |||
+ | -package-resources: | ||
+ | | ||
+ | | ||
+ | |||
+ | -package-debug-sign: | ||
+ | [apkbuilder] Creating AndroidAnt-debug-unaligned.apk and signing it with a debug key... | ||
+ | [apkbuilder] Using keystore: / | ||
+ | |||
+ | debug: | ||
+ | | ||
+ | | ||
+ | |||
+ | BUILD SUCCESSFUL | ||
+ | Total time: 8 seconds | ||
+ | </ | ||
+ | 呃,这个过程好熟悉,想起来了,之前TweeQ就是这样编译的。 | ||
+ | |||
+ | ===== 安装APK ===== | ||
+ | 再使用adb install 安装APK | ||
+ | adb install bin/ | ||
/var/www/dokuwiki/wiki/data/attic/android/build-with-ant.1278076952.txt.gz · Last modified: 2016/05/05 13:06 (external edit)