使用ADB打开Chrome

8

我曾经可以使用ADB像这样启动Chrome:

adb shell am start -n com.android.chrome/com.android.chrome.Main

但是现在当我尝试时,我得到了以下结果:
Starting: Intent { cmp=com.android.chrome/.Main }
Error type 3
Error: Activity class {com.android.chrome/com.android.chrome.Main} does not exist.

看起来主类名已经改变了。如果是这样,新的类名是什么?


这对我来说很好用。adb shell am start -a android.intent.action.VIEW -d http://www.stackoverflow.com - Murtaza Khursheed Hussain
如果您安装了多个浏览器,它会询问您要使用哪一个。我想特别针对 Chrome。 - rmcc
不要设置默认为Chrome。 - Murtaza Khursheed Hussain
1
没错,但正如我所提到的,我想特别针对Chrome。就像我用Firefox一样,但是通过执行“adb shell am start -n org.mozilla.fennec/org.mozilla.fennec.App”来实现。 - rmcc
3个回答

25

针对此项操作的Adb命令

adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main

非常感谢您的回答! - rmcc
使用 shell help - Murtaza Khursheed Hussain

4

使用ADB打开Chrome的默认页面可以使用以下命令:

adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main

相反,您可以使用以下方法直接打开一个URL:

adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d "www.facebook.com"

0
adb shell

使用默认浏览器的Webview:

am start -a android.intent.action.VIEW -d https://www.google.com/

Firefox:

monkey -p org.mozilla.tv.firefox -c android.intent.category.LAUNCHER 1

Chromium:

monkey -p org.chromium.chrome -c android.intent.category.LAUNCHER 1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接