android ubuntu下ant环境搭建
16lz
2021-01-26
假设您已经具备下列条件,否则阅读这篇文章对您帮助不会太大。
[html] view plain copy print ?
[html] view plain copy print ?
[html] view plain copy print ?
[html] view plain copy print ?
工程名称 :TestAntAndroidActivity
名称 :TestActivity
包名称 :mark.zhangandroid 版本 :4,即 android1.5
那么,在终端只需要:
[html] view plain copy print ?
修改res/layout/main.xml文件
[html] view plain copy print ?
[html] view plain copy print ?
4. 安装 apk
将上面的 apk 文件安装到模拟器,验证是否可行。
[html] view plain copy print ?
[html] view plain copy print ?
<1> ubuntu下,成功安装JDK1.6并配置环境变量
<2> ubuntu下,成功下载、配置好 ant 环境
<3> ubuntu下,成功安装android-sdk,并且配置好tools、platform-tools环境变量
好吧,开始ant开发android之旅!/home/mark/android/android-sdk-linux_x86是android_sdk安装路径。
1.android 命令
打开终端,敲入命令
- android-h
[html] view plain copy print ?
- createproject:CreatesanewAndroidproject
- updateproject:UpdatesanAndroidproject(mustalreadyhaveanAndroidManifest.xml)
[html] view plain copy print ?
- android-hcreateproject
[html] view plain copy print ?
- Usage:
- android[globaloptions]createproject[actionoptions]
- Globaloptions:
- -v--verboseVerbosemode:errors,warningsandinformationalmessagesareprinted.
- -h--helpHelponaspecificcommand.
- -s--silentSilentmode:onlyerrorsareprintedout.
- Action"createproject":
- CreatesanewAndroidproject.
- Options:
- -n--nameProjectname
- -t--targetTargetIDofthenewproject[required]
- -p--pathThenewproject'sdirectory[required]
- -k--packageAndroidpackagenamefortheapplication[required]
- -a--activityNameofthedefaultActivitythatiscreated[required]
[html] view plain copy print ?
- Usage:
- android[globaloptions]updateproject[actionoptions]
- Globaloptions:
- -v--verboseVerbosemode:errors,warningsandinformationalmessagesareprinted.
- -h--helpHelponaspecificcommand.
- -s--silentSilentmode:onlyerrorsareprintedout.
- Action"updateproject":
- UpdatesanAndroidproject(mustalreadyhaveanAndroidManifest.xml).
- Options:
- -p--pathTheproject'sdirectory[required]
- -l--libraryDirectoryofanAndroidlibrarytoadd,relativetothisproject'sdirectory
- -n--nameProjectname
- -t--targetTargetIDtosetfortheproject
- -s--subprojectsAlsoupdatesanyprojectsinsub-folders,suchastestprojects.
2. 创建项目
工程名称 :TestAntAndroidActivity
名称 :TestActivity
包名称 :mark.zhangandroid 版本 :4,即 android1.5
那么,在终端只需要:
[html] view plain copy print ?
- androidcreateproject-kmark.zhang-nTestAntAndroid-aTestActivity-t4-p/home/mark/TestAntAndroid
修改res/layout/main.xml文件
[html] view plain copy print ?
- <?xmlversion="1.0"encoding="utf-8"?>
- <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="thisismyantcompileandroidapp"
- android:textSize="20sp"
- android:textColor="#aa000a"
- />
- </LinearLayout>
提示:执行 androidlist target 可以查看安装的sdk版本
3.编译项目
[html] view plain copy print ?
- cd/home/mark/TestAntAndroid/
- antdebug
4. 安装 apk
将上面的 apk 文件安装到模拟器,验证是否可行。
[html] view plain copy print ?
- cd/home/mark/TestAntAndroid/bin
- adbinstallTestAntAndroid-debug.apk
5. 更新已有工程
[html] view plain copy print ?
- androidupdateproject-nTestAntAndroid-t11-p/home/mark/TestAntAndroid/
注意: -t 11 表示使用 android-11,当然你可以使用其他版本来更新工程。但是,有时候更新一个工程不使用 android 高版本来更新的话,项目会报错。
控制台显示信息:
[html] view plain copy print ?- Updateddefault.properties
- Updatedlocal.properties
- Filebuild.xmlistoooldandneedstobeupdated.
- Updatedfile/home/mark/TestAntAndroid/build.xml
- Updatedfile/home/mark/TestAntAndroid/proguard.cfg
更多相关文章
- android检测新版本并下载安装的方法
- 【android笔记】android开发环境搭建--android studio安装与配置
- Android(安卓)dumpsys命令学习小记
- Android项目集成ReactNative及遇到问题
- Android开发工程师笔试题
- android 手机 apk安装失败对应码
- 命令行修改Android系统时间
- Android(安卓)Studio安装与使用最详细的图解教程
- 【Android】Eclipse svn插件安装说明