参考:
http://www.cnblogs.com/meil/archive/2012/05/24/2516055.html
http://www.biemmeitalia.net/blog/android-network-configuration/
http://developer.android.com/tools/help/adb.html
1、确认电脑上安装了android设备的usb驱动。没有的话,安装豌豆荚的软件,自动安装驱动,连接到android设备。
2、确定adb工具的路径,将其添加到系统环境变量PATH中。
我的路径是..\android-sdk-windows\platform-tools,自己去查找。安装了android studio或者adt插件应该有adb工具。
3、连接上adb之后,就可以通过adb安装软件到android设备,上传文件到android设备。
a) adb install <apk文件路径>
这个命令将指定的apk文件安装到设备上
b) adb uninstall <软件名>
adb uninstall -k <软件名>
如果加 -k 参数,为卸载软件但是保留配置和缓存文件.
c) adb push <本地路径> <远程路径>
从电脑上发送文件到设备
4、连接android设备。
在windows的cmd命令提示符中查看adb所连接的设备。
adb devices
连接到设备:
adb shell
结果就和使用串口连接到android设备类似。
5、ip配置
连接到android设备之后,配置如下,也可以在串口中进行。
#配置ip: ifconfig eth0 [IP] netmast [NETMASK]
root@android:/ # ifconfig eth0 192.168.2.111 netmask 255.255.255.0
#查看ip
root@android:/ # ifconfig eth0
eth0: ip 192.168.2.111 mask 255.255.255.0 flags [up broadcast running multicast]
#添加默认网关
root@android:/ # route add default gw 192.168.2.1 dev eth0
#查看网卡状态:显示的0x00001043根据不同电脑会有不同。最后的网卡的mac地址。
root@android:/ # netcfg
lo UP 127.0.0.1/8 0x00000049 00:00:00:00:00:00
can0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
can1 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
eth0 UP 192.168.2.111/24 0x00001043 1e:ed:19:27:1a:b3
tunl0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
sit0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
ip6tnl0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
#查看所有配置
root@android:/ # getprop
[alsa.mixer.capture.headset]: [Capture]
[alsa.mixer.capture.master]: [Capture]
[alsa.mixer.playback.headset]: [Headphone]
[alsa.mixer.playback.master]: [Playback]
[alsa.mixer.playback.speaker]: [Playback]
[athr.gps.conf]: [/system/etc/gps/Orion.ini]
[back_camera_name]: [ov5640_mipi]
[back_camera_orient]: [0]
[camera.disable_zsl_mode]: [1]
[dalvik.vm.dexopt-flags]: [m=y]
[dalvik.vm.heapgrowthlimit]: [64m]
[dalvik.vm.heapmaxfree]: [8m]
[dalvik.vm.heapminfree]: [512k]
[dalvik.vm.heapsize]: [384m]
[dalvik.vm.heapstartsize]: [8m]
[dalvik.vm.heaptargetutilization]: [0.75]
[dalvik.vm.jniopts]: [warnonly]
[dalvik.vm.stack-trace-file]: [/data/anr/traces.txt]
[debug.egl.hw]: [1]
[debug.sf.enable_hgl]: [1]
[debug.sf.showfps]: [0]
[dev.bootcomplete]: [1]
[dhcp.eth0.pid]: [3098]
[dhcp.eth0.reason]: [PREINIT]
[dhcp.eth0.result]: []
[front_camera_name]: [uvc,ov5642_camera,ov5640_camera]
[front_camera_orient]: [0]
[gsm.current.phone-type]: [1]
[gsm.operator.alpha]: []
[gsm.operator.iso-country]: []
[gsm.operator.isroaming]: [false]
[gsm.operator.numeric]: []
[gsm.ril.delay]: [15]
[gsm.sim.state]: [NOT_READY]
[hw.backlight.dev]: [pwm-backlight.1]
[hwc.enable_dither]: [1]
[hwc.stretch.filter]: [1]
[init.svc.adbd]: [running]
[init.svc.bootanim]: [stopped]
[init.svc.console]: [running]
[init.svc.dbus]: [running]
[init.svc.debuggerd]: [running]
[init.svc.dhcpcd_eth0]: [stopped]
[init.svc.drm]: [running]
[init.svc.ing]: [running]
[init.svc.installd]: [running]
[init.svc.keystore]: [running]
[init.svc.magd]: [stopped]
[init.svc.media]: [running]
[init.svc.netd]: [running]
[init.svc.ril-daemon]: [running]
[init.svc.sdcard]: [running]
[init.svc.servicemanager]: [running]
[init.svc.surfaceflinger]: [running]
[init.svc.ueventd]: [running]
[init.svc.uril-repo]: [stopped]
[init.svc.vold]: [running]
[init.svc.watchdogd]: [running]
[init.svc.wifi_mac]: [stopped]
[init.svc.zygote]: [running]
[media.omxgm.enable-player]: [1]
[media.omxgm.enable-record]: [1]
[media.omxgm.enable-scan]: [1]
[net.bt.name]: [Android]
[net.change]: [net.qtaguid_enabled]
[net.data.dev]: [usb0]
[net.hostname]: [android-13db07846b71b49]
[net.qtaguid_enabled]: [1]
[net.tcp.buffersize.default]: [4096,87380,110208,4096,16384,110208]
[net.tcp.buffersize.edge]: [4093,26280,35040,4096,16384,35040]
[net.tcp.buffersize.evdo]: [4094,87380,262144,4096,16384,262144]
[net.tcp.buffersize.gprs]: [4092,8760,11680,4096,8760,11680]
[net.tcp.buffersize.hsdpa]: [4094,87380,262144,4096,16384,262144]
[net.tcp.buffersize.hspa]: [4094,87380,262144,4096,16384,262144]
[net.tcp.buffersize.hspap]: [4094,87380,1220608,4096,16384,1220608]
[net.tcp.buffersize.hsupa]: [4094,87380,262144,4096,16384,262144]
[net.tcp.buffersize.lte]: [524288,1048576,2097152,262144,524288,1048576]
[net.tcp.buffersize.umts]: [4094,87380,110208,4096,16384,110208]
[net.tcp.buffersize.wifi]: [524288,1048576,2097152,262144,524288,1048576]
[net.uril.repository]: [ready]
[persist.gps.oacmode]: [@f]
[persist.gps.suplserver]: [83.150.75.211]
[persist.gps.suplserverport]: [7275]
[persist.service.bdroid.bdaddr]: [22:22:aa:9b:b5:4e]
[persist.sys.profiler_ms]: [0]
[persist.sys.usb.config]: [mtp,adb]
[ro.FSL_AAC_PARSER]: [1]
[ro.FSL_ASF_PARSER]: [0]
[ro.FSL_AVI_PARSER]: [1]
[ro.FSL_FLAC_PARSER]: [1]
[ro.FSL_FLV_PARSER]: [1]
[ro.FSL_MKV_PARSER]: [1]
[ro.FSL_MPG2_PARSER]: [1]
[ro.adb.secure]: [0]
[ro.allow.mock.location]: [1]
[ro.baseband]: [unknown]
[ro.board.platform]: [imx6]
[ro.boot.console]: [ttymxc0]
[ro.boot.hardware]: [freescale]
[ro.bootloader]: [unknown]
[ro.bootmode]: [unknown]
[ro.build.characteristics]: [tablet]
[ro.build.date.utc]: [1459497441]
[ro.build.date]: [Fri Apr 1 15:57:21 CST 2016]
[ro.build.description]: [sabresd_6dq-eng 4.2.2 1.1.0-rc3 eng.myzr.20160401.134529 dev-keys]
[ro.build.display.id]: [sabresd_6dq-eng 4.2.2 1.1.0-rc3 eng.myzr.20160401.134529 dev-keys]
[ro.build.fingerprint]: [Freescale/sabresd_6dq/sabresd_6dq:4.2.2/1.1.0-rc3/eng.myzr.20160401.134529:eng/dev-keys]
[ro.build.host]: [myzr]
[ro.build.id]: [1.1.0-rc3]
[ro.build.product]: [sabresd_6dq]
[ro.build.tags]: [dev-keys]
[ro.build.type]: [eng]
[ro.build.user]: [myzr]
[ro.build.version.codename]: [REL]
[ro.build.version.incremental]: [eng.myzr.20160401.134529]
[ro.build.version.release]: [4.2.2]
[ro.build.version.sdk]: [17]
[ro.carrier]: [unknown]
[ro.config.alarm_alert]: [Alarm_Classic.ogg]
[ro.config.notification_sound]: [OnTheHunt.ogg]
[ro.crypto.state]: [unencrypted]
[ro.debuggable]: [1]
[ro.factorytest]: [0]
[ro.hardware.lightsensor]: [/sys/class/i2c-dev/i2c-2/device/2-0044/]
[ro.hardware]: [freescale]
[ro.kernel.android.checkjni]: [1]
[ro.kernel.android.gps]: [/dev/ttymxc1]
[ro.lightsensor.threshold]: [20]
[ro.opengles.version]: [131072]
[ro.product.board]: [SABRESD]
[ro.product.brand]: [Freescale]
[ro.product.cpu.abi2]: [armeabi]
[ro.product.cpu.abi]: [armeabi-v7a]
[ro.product.device]: [sabresd_6dq]
[ro.product.locale.language]: [en]
[ro.product.locale.region]: [US]
[ro.product.manufacturer]: [Freescale]
[ro.product.model]: [SABRESD-MX6DQ]
[ro.product.name]: [sabresd_6dq]
[ro.revision]: [397331]
[ro.ril.wake_lock_timeout]: [300]
[ro.runtime.firstboot]: [946684818221]
[ro.secure]: [0]
[ro.serialno]: []
[ro.sf.hwrotation]: [0]
[ro.sf.lcd_density]: [160]
[ro.tether.denied]: [false]
[ro.wifi.channels]: []
[rw.VIDEO_RENDER_NAME]: [video_render.surface]
[service.bootanim.exit]: [1]
[sys.boot_completed]: [1]
[sys.interactive]: [active]
[sys.usb.config]: [mtp,adb]
[sys.usb.state]: [mtp,adb]
[system_init.startsurfaceflinger]: [0]
[vold.post_fs_data_done]: [1]
[wifi.ap.interface]: [wlan0]
[wifi.interface]: [wlan0]
[wlan.interface]: [wlan0]