一。 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:
- 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.
- 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”.