New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does dexmaker work for Art? #4

Closed
jophde opened this Issue Jan 16, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@jophde

jophde commented Jan 16, 2015

Or does it only work for Dalvik? I am particularly interested in using it to proxy public methods in concrete classes.

@dshirley

This comment has been minimized.

Contributor

dshirley commented Jan 16, 2015

Based on our testing it does work with Art. When loading the .dex file, Art will automagically perform a compilation step before loading it.

@jophde

This comment has been minimized.

jophde commented Jan 17, 2015

Also, is it even possible to do bytecode manipulation on classes that are part of the Android runtime on the device?

@dshirley

This comment has been minimized.

Contributor

dshirley commented Jan 20, 2015

I'm not entirely sure how the new Android Runtime works, but previously, almost all of the basic java classes (full list here: https://android.googlesource.com/platform/frameworks/base.git/+/master/preloaded-classes) are preloaded by the zygote process. New processes are forked from Zygote, and thus receive a copy of a system ClassLoader (http://developer.android.com/reference/java/lang/ClassLoader.html#getSystemClassLoader()) that already has these classes loaded. Therefore, it isn't possible to modify these classes on the fly.

However, DexMaker allows subclassing the base system classes by generating a new dex file at runtime. The dynamically generated subclass can then be used to in the same way the base class would.

@nvictor

This comment has been minimized.

nvictor commented Apr 4, 2016

@dshirley re: dynamic bytecode manipulation. what about user defined classes?

@drewhannay

This comment has been minimized.

Contributor

drewhannay commented Dec 9, 2016

Proxying user defined classes by subclassing should work in the same way as it does for base system classes.

@drewhannay drewhannay closed this Dec 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment