2010-08-18 167 views
57

如何使用adb shell启动浏览器并显示某个网页?需要命令行才能使用adb启动Web浏览器

+0

不确定你的意思,你的意思是开始一个浏览器的意图? – BeRecursive 2010-08-18 13:14:27

+0

从CLI的任何应用程序:https://stackoverflow.com/questions/4567904/how-to-start-an-application-using-android-adb-tools – 2017-11-07 10:55:37

回答

138

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

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

我想用它来加载预先保存的页面(在SD卡上),但它会给出错误。 – shingaridavesh 2015-06-19 22:19:54

+0

这是每次我开启时打开一个新选项卡,导致一段时间后打开的选项卡混乱。 – 2016-01-22 21:01:08

34

如果你的URL被符号重,你也应该引述积极

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

我想在通过ADB我的Kindle开始丝,而无需添加新的网址。我想出了这个:

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

您可以打开的KeyEvents太默认Web浏览器(它可以编写KEYCODE_EXPLORER而不是64)

adb shell input keyevent 64 

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

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

如果要启动浏览器专门

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金丝雀版本通过

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

与com.chrome.canary交换com.android.chrome给浏览器访问到SD卡。

相关问题