终端运行dalvikvm与am.jar终端、dalvikvm、jar、am

2023-09-06 17:39:37 作者:承蒙时光待我如初恋 !

我想开始与终端dalvikvm一个安装的应用。如果我尝试做到这一点不工作只是这样:

I'm trying to start an installed app with dalvikvm in terminal. It doesn't work if I try to do this just so:

dalvikvm -cp /system/app/Calculator.apk com.android.calculator2/.Calculator

然后是失败消息: dalvikvm找不到主类

于是,我就运行日上午开始,在dalvikvm:

So I tried to run an "am start" in dalvikvm:

dalvikvm -cp system/framework/am.jar com.android.commands.am.Am 

它确实有效。但是,如果我试图然后启动一个应用程序:

It really works. But if I trying then to start an app:

dalvikvm -cp system/framework/am.jar com.android.commands.am.Am start -n com.android.calculator2/.Calculator

这是行不通的。

有人可以帮我吗?

推荐答案

有几点:

您不能运行从终端的Andr​​oid应用。在你第一个命令,它会执行一个静态无效的主要(字符串[])方法在计算机类,如果有之一。这是不可能的执行这种方式的应用程序。

You cannot run an android application from the terminal. In your first command, it would execute a static void main(String[]) method in the Calculator class, if there were one. It's not possible to "execute" an application in this manner.

使用点是开始从该终端的特定活动的正确方式。你可以简单地使用所提供的是脚本(/系统/斌/ AM)。或者至少看一下剧本,看看如何正确地调用时。

Using am is the correct way to start a specific activity from the terminal. You can simply use the provided "am" script (/system/bin/am). Or at least look at that script to see how to correctly invoke am.

例如,上午开始-n com.android.calculator2 / .Calculator 应该做你想要什么

For example, am start -n com.android.calculator2/.Calculator should do what you want

 
精彩推荐
图片推荐