使用命令编译打包Android项目:老方法ant
安装ant:
sudo apt-get install -y ant
ant编译一个项目的步骤:
echo 进入一个项目,比如demo cd ~/Downloads/android-sdk-linux/samples/android-17/ApiDemos echo 生成build.xml文件。android-19 是目标OS的意思,使用android list targets可以查看。如果没有安装SDK中的Android API,则targets为空出错。常见的有"android-19"和"Google Inc.:Google APIs:19" android update project -p . -s -t "android-19" echo 编译打包,需要jdk ant debug echo 安装到手机或者虚拟机等设备里 adb install bin/ApiDemos-debug.apk
开发时如何快速切换wifi
使用WiFi List widget Free(含通知栏广告)即可。在桌面上1秒钟切换到另一个wifi,不用进系统设置中切换。下载地址:https://play.google.com/store/apps/details?id=pl.rkmiec.wifilist.free&hl=zh_CN
效果图:

网络调试Android
Android可以使用网络编译安装(wifi或有线),不用每次都接上usb线。
要求:设备需要root
方法1:在设备中启动“终端”(如果没有,则到市场上装一个),设备终端里执行命令:
su setprop service.adb.tcp.port 5555 stop adbd start adbd
把设备用usb线接到电脑上,手机弹出“开发者授权”,同意记住。
在电脑中执行命令:
adb connect 192.168.199.193 adb devices
以后编译安装就方便了,在eclipse里直接能识别,用命令也行,比如:
adb -s 192.168.199.193:5555 install bin/demo-debug.apk
方法2、使用app自动执行上面的操作,安装WiFi ADB - Debug Over Air即可,下载地址https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb
如图:





如何安装google play
因为法律原因,所以大陆行货手机不能集成google play。
如果开发需要,则根据Android版本下载对应的gapps包,重启到recovery,刷入包即可。下载地址:http://www.appkg.com/gapps 或 http://wiki.cyanogenmod.org/w/Google_Apps 或 国内镜像下载:http://gmirror.org/#gapps
刷入以后,重启就可以看见google play,如果没安装成功,则解压缩zip包,用root explorer复制gapps-xxxx/system/app中的所有apk到 系统的/system/app中,重启即可。
使用命令创建Android项目
官方文档有详细说明:http://developer.android.com/intl/zh-cn/training/basics/firstapp/creating-project.html#CommandLine
如何解决Android模拟器虚拟机太卡
安装virtualbox,下载www.android-x86.org的最新iso,安装,就不卡了。使用网络调试android即可。
详细步骤:
Android-x86虚拟机安装配置图文教程 http://www.linuxidc.com/Linux/2013-05/84613.htm
VirtualBox安裝 Android-x86 4.0图解教程 http://www.linuxidc.com/Linux/2014-06/103262.htm
VirtualBox虚拟机试用Android-x86 4.4 RC1方法 http://www.linuxidc.com/Linux/2014-02/96804.htm
Android官方arm虚拟机未使用“CPU虚拟化”,所以很卡。而Virtualbox和iOS虚拟机都是x86的,都能调用“CPU虚拟化技术”,很流畅。
IDE
建议使用新出的、目前google主推的android studio,请看:http://tools.android.com/download/studio/canary/latest ,国内镜像下载:http://gmirror.org/#android-studio
老公司老项目会使用eclipse,请看:http://www.linuxidc.com/Linux/2014-06/103264.htm
截图:

更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2
更多Android相关信息见Android 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=11
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-08/134112.htm
