Giter Club home page Giter Club logo

Comments (5)

ms1995 avatar ms1995 commented on July 3, 2024

My prototype for fixing this problem in a not-that-elegant way:

  1. Create wrapper classes for the main Ella class in the runtime. Each of those classes will be merged to one additional DEX file. Make sure that those classes have different names. A wrapper class looks like,
public abstract class EllaWrapper {

    private static Method m_method;

    static {
        try {
            Class<?> ella_class = Class.forName("com.apposcopy.ella.runtime.Ella");
            m_method = ella_class.getDeclaredMethod("m", int.class);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static void m(int mId) {
        try {
            m_method.invoke(null, mId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}

Basically, I use Java reflection to get the reference to the main class at very beginning, and subsequent calls to m will use the reference directly.

  1. Modify Ella instrumentation to merge the main Ella classes to classes.dex and wrapper classes to classes2.dex, classes3.dex, etc. This should make sure that main Ella classes are always loaded first (before wrapper classes try to find them via reflection).

  2. Modify Ella instrumentation to target the Ella classes that are included in the respective DEX files when instrumenting each method in the app. Otherwise the instrumentor will say that it cannot find reference to the Ella main class.

One issue of this approach is that, if classes.dex already has too many methods (already reaching the 64K limitation), the approach will not work since main Ella classes cannot be merged into the main DEX file.

Hope this helps.

from ella.

yisun92 avatar yisun92 commented on July 3, 2024

@ms1995 Hi, I'm facing the same problem. Do you have a working prototype? Could you kindly share your code? Thanks a lot!

from ella.

ms1995 avatar ms1995 commented on July 3, 2024

@yisun92 I do have a working prototype and will release it later. Thanks.

from ella.

ms1995 avatar ms1995 commented on July 3, 2024

@yisun92

Please see my working version at,

https://github.com/ms1995/ella-customized

from ella.

yisun92 avatar yisun92 commented on July 3, 2024

@yisun92

Please see my working version at,

https://github.com/ms1995/ella-customized

Thanks! I'll have a try

from ella.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.