Is it possible to execute task directly on Dalvik VM machine as we run other virtual machines on desktop system?
-
Is there any tutorial or any link that can help me to run tasks directly DVM – Yash Feb 22 '13 at 03:47
-
I mean through command line writing some commands that executes .apk file? – Yash Feb 22 '13 at 04:32
2 Answers
If i have understood your question correctly :I'm considering task
mentioned in question as apk (If so then following answer might help ypu)
If you have your target connected to host then you can use two of the most common command tools :
activity manager (am)
package manager (pm)
First install apllication through command line adb install <path_to_apk>
For example : adb shell am start -a android.intent.action.MAIN -n com.android.settings/.Settings
will launch settings .
If you don't know that package name or any activity name then start application from GUI ,then capture the logs using logcat it will show you action,category,component .
After knowing action,category,component use am
command as shown above
Please check this link
Also check documentation
And for Dalvik Debugger Support check this link
If all you want to do is run a command-line program on the device, it's pretty straightforward. The Android sources include a document describing how to do it in dalvik/docs/hello-world.html (original docs), including instructions for using a debugger.
Here's the example from that page:
% echo 'class Foo {'\
> 'public static void main(String[] args) {'\
> 'System.out.println("Hello, world"); }}' > Foo.java
% javac Foo.java
% dx --dex --output=foo.jar Foo.class
% adb push foo.jar /sdcard
% adb shell dalvikvm -cp /sdcard/foo.jar Foo
Hello, world

- 39,650
- 37
- 158
- 244

- 51,356
- 5
- 116
- 166