终端运行dalvikvm与am.jar [英] Terminal run dalvikvm with am.jar

查看:193
本文介绍了终端运行dalvikvm与am.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开始与终端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

这是行不通的。

有人可以帮我吗?

推荐答案

有几点:


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

  1. 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

这篇关于终端运行dalvikvm与am.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆