Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[Zac Sweers] Breaking the Android ClassLoader

[Zac Sweers] Breaking the Android ClassLoader

Presentation from GDG DevFest Ukraine 2018 - the biggest community-driven Google tech conference in the CEE.

Learn more at: https://devfest.gdg.org.ua

__

ClassLoaders are not new. They've existed since Java 1.0 and are a core part of how the JVM works. Things work a bit different under the hood in Android, but the core principles are the same and we, as Android developers, largely take it for granted. This talk will be a deep dive into how class loading works in Android and later explore the implications of trying to manipulate the application's ClassLoader at runtime (for better or worse 🔥) in the context of logging, hot fixing, adding features, and interacting with 3rd party code.

Google Developers Group Lviv

October 13, 2018

Transcript

44 slides
  1. class ClassLoader {a Class<?> loadClass(String name); Class<?> findClass(String name); Class<?>

    defineClass(...); URL getResource(String name); // A few others }a
  2. class ClassLoader {a Class<?> loadClass(String name); Class<?> findClass(String name); Class<?>

    defineClass(...); URL getResource(String name); // A few others }a
  3. package example; class Foo { private Bar bar; }a loadClass("example.Foo")

    Foo.class.getClassLoader().loadClass("example.Bar")
  4. class CustomClassLoader extends PathClassLoader { @Override public Class<?> loadClass(String name)

    { Log.d("ClLoading", "Loading " + name); return super.loadClass(name); } }

More Decks by Google Developers Group Lviv

Other Decks in Technology