Um, you are making this way too hard.  You should load code with this:

http://developer.android.com/reference/android/content/Context.html#createPackageContext(java.lang.String,
int)

And please please note, there are major security and functional issues with
loading code like this.  If this isn't all code you have written that is
only running in your own app, you really need to seriously rethink what you
are doing.

Security -- you are allowing someone else's code to run in your process,
with your identity, with your permissions.  They can do everything you can,
as you, so any problems in their code are effectively -your- problem.

Functionality -- the code is loading and running with your uid, so it can
not request its own permissions, and can only read and write files under
your data directory.  if multiple applications load it, all of its data is
isolated in each of those apps, and it ends up running with different
permissions depending on the app.

On Fri, Dec 18, 2009 at 12:12 PM, B++ <[email protected]> wrote:

> After some further analysis, I noticed that memory resources are
> released if the loaded class belongs to the same apk as the app. The
> problem seems to be apparent if a loaded class belongs to a different
> apk. It looks like the resources about the class extraction are not
> getting released properly.
>
> fadden, I create a new class loader onCreate(), so that I will always
> ensure that a new apk is loaded everytime the app is launched.
> Ideally, I would like to clean these resources onDestroy, but
> supposedly, this should be handled by gc.
>
> By the way, the loaded apk represents a plugin (A simple class, and
> some plugin specific resources), and onCreate, I need to check if
> plugin has changed, but this is not possible without loading the class
> from the apk first :)
>
>
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Reply via email to