Now I used dexdump on /data/app/com.my.internal.apk and saw SystemProperties class is in the classes.dex file:
Class #9 - Class descriptor : 'Lcom/sprint/internal/SystemProperties;' Access flags : 0x30001 (PUBLIC VERIFIED OPTIMIZED) Superclass : 'Ljava/lang/Object;' Can someone tell me why DexClassLoader.loadClass can not find it? Thanks. Sherry On May 29, 1:10 pm, sherry <syang...@gmail.com> wrote: > I have an apk installed in /data/app. I want to use the class methods > in there. Here is what I tried: > > public void test0method(){ > DexClassLoader dLoader = new DexClassLoader("/data/app/ > com.my.internal.apk", > "/data/local/tmp", null, > ClassLoader.getSystemClassLoader()); > try { > Class cLoad = dLoader.loadClass > ("com.my.internal.SystemProperties"); > // got ClassNotFoundException at above line > Method mLoad = cLoad.getMethod("GetString",new Class[]{}); > Object obj = cLoad.newInstance(); > Object sysProp = cLoad.newInstance(); > mLoad.invoke(obj); > } catch (Exception e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > I got "ClassNotFoundException". By peeking into the apk, I don't see > class files but classes.dex. I would assume SystemProperties class is > in classes.dex. Why can I load it? > > What did I do wrong? > > Thanks, > > Sherry --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---