I've been trying to load a class with DexClassLoader, but it doesn't
really work.
There was a couple of posts about this, so I tried some of them, but
it didn't work.

Here's my code:

DexClassLoader dLoader = new DexClassLoader("/data/app/
com.testpackage.test2.apk", "/data/dalvik-cache", null,
ClassLoader.getSystemClassLoader());
                        try {
                                Class cLoad = 
dLoader.loadClass("com.testpackage.test2.Test2");

                        } catch (ClassNotFoundException e) {
                                Log.d("ERROR", "Class Not Found");
                                e.printStackTrace();
                        }

As you can see, I used "/data/dalvik-cache" for the 2nd parameter of
DexClassLoader constructor because I found the dex file of this
package in that directory. (I saw a person used "/data/app-private",
but that directory has nothing in it)

When I ran this code, I got 'ClassNotFound' exception, and right
before that, I got the following log, "Can't open dex cache '/data/
dalvik-cache/com.testpackage.test2.dex': No such file or directory".

If you look into the directory, '/data/dalvik-cache', all dex files
are preceded with the directory where it is located, but it appears
that DexClassLoader doesn't know about that. I mean if I'm right about
the dexOuputPath, it should try to find dex with
"d...@app@com.testpackage.test2.dex".

Is this a kind of bug? or... am I doing something wrong?
Please help me~!! T^T

Great thanks in advance. =D
--~--~---------~--~----~------------~-------~--~----~
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