porting dalvik doesn't needs emulator?

by xliu » Wed, 07 Jul 2010 00:00:49 GMT


Sponsored Links
 Hi list,

we are planing to port dalvikvm to a new cpu.  we're worry about
emulator issue because clearly qemu doesn't support own homebrew cpu.
so i took a dirty investigation on the relationship between qemu-
emulator-dalvik.  could you go through my sum up and give me some
comments?

The role of emulator in dalvik
applications storing in android system in the form of apk(android
package). actually it's a zip archive with some metadata. it contains
a file named classes.dex. the file is compact to save storage.
however, dex file can not execute directly after memory-mapped. it
needs to transform to ODEX file, which O means "optimized" here.

i think the name of ODEX is a little misleading since the phrase
contains 3 purposes, while "optimization" is only one of them.
  i) realignment and byte-swapping.
  ii) verification  dex code
  iii) optimization

There're at least 3 different ways to get odex job done. i iterate
them in chronicle order:
  i)[build-time] The building system does it ahead of time.
  ii)[install-time] The system installer does it when an application
is first added(to device).
  iii)[run-time] The VM does it "just in time"

It is the #1 choice needs the emulator, which will communicate with
underlying QEMU. as doc said, The building system use a hairy process
that involves the emulator , force JIT optimization of all relevant
dex files and then extract the result from dalvik-cache. i don't know
the exact meaning of "hairy" here. but i found the hairy process in
android source. it is android/build/tools/dexpreopt/dexpreopt.py. The
python script will spawn the emulator in shell form(no GUI like
attachment), secretely run dexopt on it with dex files, and pull
optimized results from emulator. In default, android building system
performs dexpreopt for system-level java programs instead of
applications. i also notices that it forbid the dexpreopt on Mac OSX,
as the comments said in android/build/core/product_config.mk

# Hack to make the linux build servers use dexpreopt.
# OSX is still a little flaky.

so i think we can skip choice #1 and leave dalvik perform dex-odex at
install-time or runtime. it's clear that #2 and #3 occurs on real
device. no emulator need.



-- 



porting dalvik doesn't needs emulator?

by fadden » Thu, 08 Jul 2010 06:19:02 GMT


 


You are correct -- the emulator only matters for "user" builds, where
the build system launches the emulator to run dexopt.  You don't need
it for your porting work.  You could even do the dexpreopt step with a
real device if you don't mind having one plugged into the build
machine.

dalvik/docs/porting-guide.html should explain all you need.

-- 


Sponsored Links


Other Threads

1. Android REST Client (jsr311)

Hello everybody!

I'm a student and we are trying to build a android REST Client. At
first we tried this with the SUN Jersey Libs, but this don't seem to
work. For Example:

private Client client = new Client();
private WebResource wr = new WebResource();
private OwnObjectType object = new OwnObjectType();
...

wr = client.resource(URL);
try {
            wr.accept(MediaType.APPLICATION_XML_TYPE);
            object = wr.get(OwnObjectType.class);
        }

Building this with the included Jersey Libs is working fine, but when
executed the wr.get() throws a NullPointerExecption from internal
Jersey Libs. The same code runs fine in a "normal" Java-App.
So we tried with the standard android packages org.apache.http. which
works again fine..
But now I'm stuck at getting the Object from the XML response Stream.
So i downloaded a modified Version of Xstream for android:
http://jars.de/java/android-xml-serialization-with-xstream:

try {

            response = client.execute(get);

            if(response.getEntity() != null) {

                XStream stream = new XStream();
                pr = (ProduktResponse) stream.fromXML
(response.getEntity().getContent());
            }

Including and building works fine, but when used android throws a
ClassNotFoundException:

06-04 18:34:11.313: ERROR/dalvikvm(1079): Could not find class
'com.thoughtworks.xstream.converters.basic.IntConverter', referenced
from method com.thoughtworks.xstream.XStream.setupConverters

even if the class is totally present in the jar-file.

So, doe's anyone know how to do this with jersey or how to use XStream
on android?

Best Regards,

Martin

--~--~---------~--~----~------------~-------~--~----~

2. sdk version

I am using Android and Eclipse. How can I check which version of the
android SDK that is installed?
--~--~---------~--~----~------------~-------~--~----~

3. adt export wizard

4. Problem with eclipse pointing to the SDK

5. Can't remove some apps after cupcake update

6. how to select all or deselect all views in listview using checkboxes in android?

7. Hooking Chrome's share ?