Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:00:49+00:00 2026-06-08T17:00:49+00:00

I’m wondering if it’s possible to parcel (or serialize) a ClassLoader to send it

  • 0

I’m wondering if it’s possible to parcel (or serialize) a ClassLoader to send it through a Message to another process in Android. ClassLoader doesn’t implement Parcelable/Serializable.

Any hints on how to do this? Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:00:51+00:00Added an answer on June 8, 2026 at 5:00 pm

    Class loader

    A class loader is basically a hash table whose entries are keyed by class name and points to byte code loaded in the VM. Byte code loaded in the VM itself is of course off limits to Java processes, as Java does not allow you to manipulate code. Note that the bytecode has been compiled by the JIT VM into CPU-specific code and will contain memory locations and other low-level constructs.

    It is possible to share class loaders (via serialization or otherwise) within the same VM, since the class loader will still be able to point to the original byte code. However, in order to serialize then deserialize into another VM, the class loader would have to serialize the byte code. And there is the problem.

    Serializing a class loader

    As a thought experiment, how would we serialize the code so that the other process could deserialize it?

    We would have to handle this as class-sized chunks so the serialized entity has the entire class interface. We would have to ‘unresolve’ pointers in the bytecode to symbols. We would also have to copy the entire string and symbol table for the class so introspection continues to work.

    What we have just defined is the class file itself (a slight difference being the initialisation vs. serialisation of class members)

    Let me repeat that: A class file is the serialized version of a class.

    The DEX conundrum

    However, Android pre-compiles class files into the DEX. This is a single file which contains an optimized version of a JAR – classes are pre-linked with each other and all strings symbols sit in the same shared string/symbol pools. So, in Android, you the smallest sharable component is the DEX.

    In many instances app or device makers create an ODEX file. This is a DEX file that has been compiled to a specific CPU and architecture (including big-endian or little-endian systems).

    In Android you can think of the ODEX file as the serialized class loader.

    Remote class loading

    The crux of the problem is how one process can load class files visible to the original process. yorkw suggested a class loader s/he found which does something like what I have suggested. The approach is that the first process implements a class-lookup service, returning the class bytecode. However this won’t work on Android directly because of the DEX problem listed above.

    Solution?

    Any solution that you implement is therefore going to be based on the (O)DEX. You basically need to have your client talk to your server and request a (O)DEX file, then load it as a single entity. Loading it will return your new class loader

    Now, I have never done this, and it is entirely possible that Android allows just one DEX file to be loaded scuppering this approach. YMMV

    I do hope this discussion helps…


    TL;DR You can’t serialize a class loader; however you might be able to persuade another process to load a (O)DEX file which would produce the same result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.