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 8027925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:58:00+00:00 2026-06-04T23:58:00+00:00

I’m writing an instrumentation library that I’d like to work on both desktop and

  • 0

I’m writing an instrumentation library that I’d like to work on both desktop and mobile (Android).

It functions by:

  1. Exposing a main which takes a single parameter, the main of the target class
  2. Installing a class loader which intercepts all classes as they are loaded and instruments them

Like so:

    // Expects args[0] to contain the name of the INNER main
    public static void main(String[] args) throws Throwable {
            String className = args[0];
            String [] newArgs = new String[0];

            if(args.length > 1) {
                    newArgs = Arrays.copyOfRange(args, 1, args.length-1);
            }

            System.out.println("Bootstrapping " + className);

            Loader s = new Loader(ClassLoader.getSystemClassLoader().getParent());
            Class<?> c = s.loadClass(className);
            c.getDeclaredMethod("main", new Class[] { String[].class }).invoke(
                            null, new Object[] { newArgs });
    }

The question is this:

How can I do roughly the same thing for an android app?

One idea is to modify the android manifest to replace the existing activities with “wrapper” activities, that then install class loaders and call into the original underlying activity. Is there a better way?

  • 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-04T23:58:02+00:00Added an answer on June 4, 2026 at 11:58 pm

    There is a project called droidbox to detect android malware. There is a code that can help you a lot.

    package com.loader;
    
    import dalvik.system.DexClassLoader;
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    
    public class LoaderActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            DexClassLoader dLoader = new DexClassLoader("/sdcard/DroidBoxTests.apk","/sdcard/", null, ClassLoader.getSystemClassLoader().getParent());
    
            Class calledClass = null;
            try {
                calledClass = dLoader.loadClass("droidbox.tests.DroidBoxTests");
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            Intent it=new Intent(this, calledClass);
            it.setClassName("droidbox.tests", "droidbox.tests.DroidBoxTests");
            startActivity(it);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am writing an app with both english and french support. The app requests
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.