关于android:需要命令行来使用adb启动Web浏览器

Need command line to start web browser using adb

如何使用adb shell命令启动浏览器并使其打开某个网页?


运行此命令将在android中启动Web浏览器:

1
adb shell am start -a android.intent.action.VIEW -d http://www.stackoverflow.com


如果你的网址符号很重,你也应该积极引用

1
adb shell am start -a android.intent.action.VIEW -d 'http://stackoverflow.com/?uid=isme\&debug=true'


我想通过adb在我的kindle上开始丝绸,而不添加新网址。 我想出了这个:

1
adb shell am start -n com.amazon.cloud9/.browsing.BrowserActivity

如果您想专门启动Chrome

1
2
3
adb shell am start \
-n com.android.chrome/com.google.android.apps.chrome.Main \
-a android.intent.action.VIEW -d 'file:///sdcard/lazer.html'

同时让Chrome访问sdcard via

1
adb shell pm grant com.android.chrome android.permission.READ_EXTERNAL_STORAGE

如果您使用Chrome canary版本,请使用com.chrome.canary交换com.android.chrome。


您也可以使用keyevent打开默认Web浏览器(可以编写KEYCODE_EXPLORER而不是64)

1
adb shell input keyevent 64

输入网址提交:(66 - > KEYCODE_ENTER)

1
adb shell input text"stackoverflow.com" && adb shell input keyevent 66