Yash
Yash

Reputation: 650

Execution of Dalvik VM directly on desktop

Is it possible to execute task directly on Dalvik VM machine as we run other virtual machines on desktop system?

Upvotes: 4

Views: 1254

Answers (2)

fadden
fadden

Reputation: 52303

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

Upvotes: 2

Imposter
Imposter

Reputation: 2686

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

Upvotes: 4

Related Questions