Hi friends,

I have an application which dynamically creates classes at runtime (in
the dex format). Is it possible to load these dex bytes directly
without saving them to a dex file, and then zipping it (many such
classes are created). An equivalent of
ClassLoader.defineClass(className, classDexBytes, 0,
classDexBytes.length) is what I'd like. I.e. a DexClassLoader that
doesn't have to reference a physical file, but can be passed byte
arrays instead.

If I try just extending ClassLoader is get a
java.lang.UnsupportedOperationException: can't load this type of class
file
despite the byte[] definitely being in dex format (it starts with 'd'
'e' 'x' bytes). The trace for this is:
W/System.err(  362): java.lang.UnsupportedOperationException: can't
load this type of class file
W/System.err(  362):    at java.lang.VMClassLoader.defineClass(Native
Method)
W/System.err(  362):    at
java.lang.ClassLoader.defineClass(ClassLoader.java:338)
W/System.err(  362):    at
java.lang.ClassLoader.defineClass(ClassLoader.java:301)

Thank you very much for your help,
Tomasz

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to