localacct
localacct

Reputation: 787

Inspect Java bytecode using Bytecode Frameworks (Android)

I am trying to achieve the following:

I came across the term bytecode framework and online searches led me to ASM, Byte Buddy etc. I tried to get a ClassReader object of java.lang.Object and I got a ClassNotFound exception in Android.

        try {
            ClassReader classreader = new ClassReader("java.lang.Object");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

For various testing, I have included the following in my build.gradle file

    implementation("net.bytebuddy:byte-buddy-android:1.14.12")

    implementation("org.ow2.asm:asm:9.4")
    implementation("org.ow2.asm:asm-util:9.2")

For now, I want to be able to list or print the opcodes of the methods in a class.

Has anyone gotten this to work in Android? Any help is appreciated.

References

Upvotes: 0

Views: 74

Answers (0)

Related Questions