VirtualBox下使用Ubuntu 虚拟机Android 真机做开发调试

本文介绍了如何在VirtualBox的Ubuntu虚拟机环境下,通过无线方式连接并调试Android真机。首先,需要确保手机与电脑连接同一WiFi网络,并安装adbWireless应用以允许通过WiFi进行adb连接。在电脑上,通过Eclipse的“运行配置”手动选择设备,即可实现无线调试。这种方法比使用慢速的Android模拟器更有效率。
摘要由CSDN通过智能技术生成

 

一。 virtualbox下很难将两个网络设在同一网段下,失败

Debugging Your Android App Wirelessly on an Android Smartphone

Introduction

Developing for Android is very easy to set up and get started on your computer.  However, a gripe shared among others, not just me, is that the Android emulatoris too slow.  On my old computer, it would take 1-2 minutes for it to boot up.  In debugging mode, the response time is very slow.

There are two methods:

  1. Connect your phone to your computer and find the drivers online (if needed) to allow adb to recognize your phone as a running Android device.  Eclipse and the ADT plugin will take care of the rest.
  2. The super dumb way is to take the .apk file that your Android project generates every time it compiles (at yourappfolder/bin/yourapp.apk), connect your phone to the computer via USB, push it to your phone, and install.  But that is also very inefficient (and dumb)!  What if you just wanted to test a small change real quick?  You would have to keep your phone tethered to the computer, and constantly overwrite your .apk file and re-install your application each time you wanted to test it on your phone.

I have a way that allows you to test your Android application on your Android smartphone withoutphysicallyconnecting your phone to your computer.  All it requires is a rooted Android smartphone, and a shared wifi network between the computer and the phone.

Note: This method requires a phone with root access, and accessing adb over a wifi network might be a security concern for some.  Take this method for what it’s worth.  If you are doing this on your own home network that is trusted and encrypted there shouldn’t be a problem, but I would avoid doing this in a public wifi network.

 

What to do on your phone

Make sure you are connected to the same local network that your computer is on viaWiFi.  You will then need an app calledadbWireless, it allows a rooted phone to allow adb connection to your phone as if it was connected by USB.  Once you install adbWireless and allow root privileges, press the giant red button to begin.

It will provide you with a one-line command to run in your command prompt, something similar to “adb connect 192.168.1.106:5555″.  You can type “adb devices” afterwards to verify that your device is successfully connected.  That is all you have to do on the phone.

What to do on your computer

Go to Eclipse and click on the green play button so a drop-down list appears.  Press “Run Configurations”.

Next, press “Target”.  Change the radio button from “Automatic” to “Manual”.  Press “Apply” then “Run”.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值