android 札记二 在批处理和shell script中运行android
来源:互联网 发布:京东装修和淘宝一样吗 编辑:程序博客网 时间:2024/06/06 00:30
使用批处理方式创建运行android项目
1)dirmanager.bat
@echo offrem 设置jdk目录set JAVA_HOME=D:\Program Files\Java\jdk1.6.0_24rem 设置工作平台目录set workdir=D:\workspacesrem 设置android sdk目录set andoriddir=D:\sxt developer\android-sdk-windowsrem 设置ant目录set antdir=D:\sxt developer\java tools\apache-ant-1.8.2rem 设置avd名称set avdname=AVD2.2rem 环境设置结束set path=%path%;%%JAVA_HOME%%\binset classpath=.;%%JAVA_HOME%%\libset tooldir=%andoriddir%\toolsset adbdir=%andoriddir%\platform-tools
2)androidmanager.bat
@echo offrem author hanbingrem 设置环境变量和目录call dirmaneger.batset /p proname=请输入项目名称::toolstartecho ************************************echo 1.create avd 【创建AVD】echo 2.create project【创建项目】echo 3.ant compile 【编译项目】echo 4.run emulator 【运行emulator】echo 5.install apk 【安装apk】echo 6.uninstall apk 【卸载apk】set /p input=请选择一项任务:echo ************************************if "%input%"=="1" goto oneif "%input%"=="2" goto twoif "%input%"=="3" goto threeif "%input%"=="4" goto fourif "%input%"=="5" goto fiveif "%input%"=="6" goto sixif "%input%"=="exit" goto exitgoto toolstart:oneecho 【INFO】 create avd %avdname%call "%tooldir%\android" list targetcall "%tooldir%\android" create avd -n %avdname% -t "android-8" -s HVGA -p "%workdir%\%avdname%" -fgoto toolstart:twoif "%proname%"=="" goto endif "%proname%"=="""" goto endif exist "%workdir%\%proname%" goto twotwoecho 【INFO】 create project %proname%call "%tooldir%\android" create project -n %proname% -t "android-8" -k com.sxt.android -a %proname%Activity -p "%workdir%\%proname%"goto toolstart:twotwoecho 【INFO】 project is existgoto toolstart:threeif "%proname%"=="" goto endif "%proname%"=="""" goto endcd /d "%workdir%\%proname%"echo 【INFO】 ant complilecall "%antdir%\bin\ant" debuggoto toolstart:fourecho 【INFO】 run emulator and logcatcall "%tooldir%\android" list avdstart "emulatorwin" "%tooldir%\emulator" -avd %avdname% -logcat Dgoto toolstart:fiveecho 【INFO】 install android apkcall "%adbdir%\adb" devicescall "%adbdir%\adb" install -r "%workdir%\%proname%\bin\%proname%-debug.apk"goto toolstart:sixecho 【INFO】 uninstall apkcall "%adbdir%\adb" uninstall com.sxt.androidgoto toolstart:end
linux下面的shell script
#!/bin/bash#androidManager#author:sxt date:2011/11/02#eclipse的工作台目录workdir=/home/sxt102400/workspace#android的SDK目录androiddir=/usr/android-sdk-linux#ant的目录antdir=/usr/apache-ant-1.8.2#创建AVD的名称avdname=avd2.3###############################################tooldir=${androiddir}/tools adbdir=${androiddir}/platform-tools flag=1read -p "请输入项目名称" pronameread -p "请输入Applaication名称" appnameactname="${appname}"Activity while test $flag = 1doecho ************************************ echo 1.create avd 【创建AVD】 echo 2.run emulator 【运行emulator】 echo 3.create project【创建工程】 echo 4.ant compile 【编译工程】 echo 5.install apk 【安装apk】 echo 6.uninstall apk 【卸载apk】 echo 7.add ant with project 【添加ANT】 echo 0.other project 【其他工程】read -p "请选择一项任务" inputecho ************************************ if [ "${input}" = "1" ];thenecho 【INFO】 create avd ${avdname} sh "${tooldir}/android" list targetsh "${tooldir}/android" create avd -n "${avdname}" -t "android-10" -s HVGA\ -p "${workdir}/${avdname}" -f fiif [ "${input}" = "2" ];thenecho 【INFO】 run emulator and logcatif [ ! -f $HOME/android/logcat.txt ] then mkdir $HOME/android/touch $HOME/android/logcat.txtfi(exec "${tooldir}/emulator" -avd "${avdname}" &>$HOME/android/logcat.txt &)#-logcat D fi if [ "${input}" = "3" ];then echo 【INFO】 create project【创建项目】 if [ ! -d "${workdir}/${proname}" ] thensh "${tooldir}/android" create project -n ${proname} -t "android-10" -k com.sxt\ -a "${actname}" -p "${workdir}/${proname}" else echo the project is exists fifi if [ "${input}" = "4" ];thenecho 【INFO】 ant compile 【编译项目】cd "${workdir}/${proname}" sh "${antdir}/bin/ant" debug fiif [ "${input}" = "5" ];thenecho "【INFO】 install apk 【安装apk】" (exec "${adbdir}/adb" install -r "${workdir}/${proname}/bin/${proname}-debug.apk") fiif [ "${input}" = "6" ];thenecho 【INFO】 uninstall apk 【卸载apk】(exec "${adbdir}\adb" uninstall com.sxt)fiif [ "${input}" = "7" ];thenecho 【INFO】add ant with project 【添加ANT】 sh "${tooldir}/android" update project -n ${proname} -t "android-10" -p "${workdir}/${proname}" fiif test ${input} = 0;thenecho 【INFO】other project 【其他工程】read -p "请输入项目名称" pronameread -p "请输入Applaication名称" appnameactname="${appname}"Activity fidone
- android 札记二 在批处理和shell script中运行android
- android中运行shell
- Android 代码中运行shell
- Android Monkey之script脚本--编写和运行
- Android学习札记45:在TextView中设置超链接
- UNIX的批处理 Shell Script
- Unix Shell中运行批处理的方法
- android运行模拟器脚本(批处理)
- Android实战简易教程-第四十三枪(Shell Script 运行Command)
- Android实战简易教程<四十三>(Shell Script 运行Command)
- 在模拟器中运行android
- Android札记
- Android札记
- shell script里面判断某个程序是否还在运行
- echo -e 在shell script 方式下运行的问题
- shell script 中#!的作用和读法
- shell script基础(二)
- Android学习札记49:在Android中使用Application保存全局变量
- linux下svn命令大全
- 用C#编写简单的“图像滚动展示动画效果”
- 中国象棋博弈程序研究与实现
- 高质量C++编程学习笔记
- [wxPython学习]使用PubSub机制来更新视图
- android 札记二 在批处理和shell script中运行android
- SPI通信协议
- Ext 点滴
- Oracle 建立表空间
- error code
- ByteToStr
- citrix 问题总结 1
- 弄了一下午!
- 线程中的生产者和消费者的模拟