{"id":385,"date":"2022-04-24T20:07:13","date_gmt":"2022-04-24T12:07:13","guid":{"rendered":"http:\/\/pareto.fun\/?p=385"},"modified":"2022-04-24T20:07:14","modified_gmt":"2022-04-24T12:07:14","slug":"androidlowlevel-%e6%9c%aa%e5%ae%8c%e5%be%85%e7%bb%ad","status":"publish","type":"post","link":"http:\/\/pareto.fun\/?p=385","title":{"rendered":"androidLowLevel &#8211; \u672a\u5b8c\u5f85\u7eed"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">ART &#8211; \u53cc\u4eb2\u59d4\u6d3e\u673a\u5236<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">motivation<\/h2>\n\n\n\n<p>\u4e86\u89e3\u70ed\u4fee\u590d\u5b9e\u73b0\u673a\u5236\uff0c\u80fd\u591fhook \u70ed\u4fee\u590d\u4e2d\u7684\u4ee3\u7801\u3002<\/p>\n\n\n\n<p>\u70ed\u4fee\u590d\uff1a<\/p>\n\n\n\n<p>\u4e0d\u901a\u8fc7\u91cd\u65b0\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u5b89\u88c5apk \uff0c\u6765\u66f4\u65b0APK\u7684\u76ee\u7684\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ClassLoader<\/h2>\n\n\n\n<p>\u7528\u4e8e\u88c5\u8f7dClass\u7684\u88c5\u8f7d\u5668\uff0c\u8fd9\u4e2a\u7c7b\u52a0\u8f7d\u5668\u80fd\u8fbe\u5230\u4ec0\u4e48\u6548\u679c\uff1f<\/p>\n\n\n\n<ol><li>\u7528\u6237\u65e0\u9700\u5173\u5fc3\u7c7b\u52a0\u8f7d\u7684\u6d41\u7a0b\u3002<\/li><li>\u5b9e\u73b0\u7528\u65f6\u52a0\u8f7d\u3002<\/li><\/ol>\n\n\n\n<p><strong>\u4e00\u4e9b\u57fa\u7840\u7684ClassLoader\uff1a<\/strong><\/p>\n\n\n\n<p>BootClassLoader \u52a0\u8f7d\u7cfb\u7edf\u57fa\u7840\u5e93\uff0c\u6bd4\u5982 java.lang.String \u3002<\/p>\n\n\n\n<p>PathClassLoader \u7528\u4e8e\u52a0\u8f7dApk\u4e2d\u7684dex\u6587\u4ef6\uff0c\u6574\u4e2aapk\u7684class\u90fd\u53ef\u4ee5\u627e\u5230\u3002<\/p>\n\n\n\n<p>DexClassLoader \u5e38\u7528\u4e8e\u63d2\u4ef6\u5316\u8bbe\u8ba1\uff0c\u63d2\u4ef6\u7684ClassLoader\u96c6\u6210\u8be5\u7c7b\u3002<\/p>\n\n\n\n<p><strong>\u52a0\u8f7d\u903b\u8f91<\/strong><\/p>\n\n\n\n<ol><li>\u5982\u679c\u4e00\u4e2a\u7c7b\u52a0\u8f7d\u5668\u52a0\u8f7d\u4e86\u4e00\u4e2a\u7c7b\uff0c\u90a3\u4e48\u8fd9\u4e2a\u7c7b\u52a0\u8f7d\u5668\u5c06\u8fd9\u4e2a\u7c7b\u7f13\u5b58\u8d77\u6765\u3002\u6bcf\u6b21\u52a0\u8f7d\u7c7b\u7684\u65f6\u5019\uff0c\u9996\u5148\u4f1a\u5148\u8bbf\u95ee\u6307\u5b9a\u7c7b\u52a0\u8f7d\u5668\u7684\u7f13\u5b58\uff0c\u82e5\u7f13\u5b58\u4e2d\u5b58\u5728\uff0c\u5c31\u76f4\u63a5\u4ece\u7f13\u51b2\u533a\u91cc\u8fd4\u56de\u5373\u53ef\uff0c\u8fd9\u53ef\u4ee5\u63d0\u9ad8\u7c7b\u52a0\u8f7d\u7684\u6027\u80fd\u3002(\u672a\u4ece\u4ee3\u7801\u53d1\u73b0\u8be5\u903b\u8f91)<\/li><li>\u5982\u679c\u7f13\u51b2\u533a\u627e\u4e0d\u5230\uff0c\u8bf4\u660e\u662f\u7b2c\u4e00\u6b21\u52a0\u8f7d\uff0c\u90a3\u4e48\u5982\u679c\u6307\u5b9a\u7c7b\u52a0\u8f7d\u5668\u6709\u7236\u52a0\u8f7d\u5668\uff0c\u5219\u4f18\u5148\u8ba9\u7236\u52a0\u8f7d\u5668\u52a0\u8f7d\u8be5\u7c7b\u3002\u6240\u4ee5\u7c7b\u52a0\u8f7d\u5668\u5177\u6709\u5c42\u7ea7\u5173\u7cfb\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u8d1f\u8d23\u52a0\u8f7d Java \u57fa\u672c\u7c7b\u548c\u6269\u5c55\u7c7b\u7684\u7c7b\u52a0\u8f7d\u5668\u5fc5\u987b\u5904\u4e8e\u7c7b\u52a0\u8f7d\u5668\u5c42\u7ea7\u4e2d\u7684\u9876\u5c42\u3002\u7236\u52a0\u8f7d\u5668\u52a0\u8f7d\u7c7b\u7684\u8fc7\u7a0b\u4e5f\u9075\u5faa\u540c\u6837\u7684\u89c4\u5219\u3002<\/li><li>\u5982\u679c\u6ca1\u6709\u7236\u52a0\u8f7d\u5668\u6216\u8005\u7236\u52a0\u8f7d\u5668\u4e5f\u52a0\u8f7d\u4e0d\u5230\uff0c\u5219\u8fd4\u56de\u5f53\u524d\u7c7b\u52a0\u8f7d\u5668\uff0c\u7531\u81ea\u5df1\u8bfb\u5165\u5b57\u8282\u7801\u5e76\u59d4\u6258\u865a\u62df\u673a\u6267\u884c\u540e\u7eed\u52a0\u8f7d\u8fc7\u7a0b\u4e14\u8fd4\u56de\u751f\u6210\u7684\u7c7b\u3002<\/li><\/ol>\n\n\n\n<p>\u76f8\u5173\u4ee3\u7801\u5b9e\u73b0<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">public abstract class ClassLoader {<br>    <br>    ...<br>    ...<br>    ...<br>    <br>    protected Class&lt;?&gt; loadClass(String name, boolean resolve)<br> &nbsp; &nbsp; &nbsp; &nbsp;throws ClassNotFoundException<br> &nbsp;  {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/ First, check if the class has already been loaded<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Class&lt;?&gt; c = findLoadedClass(name);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (c == null) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (parent != null) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;c = parent.loadClass(name, false);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } else {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;c = findBootstrapClassOrNull(name);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } catch (ClassNotFoundException e) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/ ClassNotFoundException thrown if class not found<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/ from the non-null parent class loader<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br>\u200b<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (c == null) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/ If still not found, then invoke findClass in order<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/ to find the class.<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;c = findClass(name);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return c;<br> &nbsp;  }<br> &nbsp;  ...<br>    ...<br>    ...<br>}<br>\u200b<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u63d2\u4ef6\u5316\u5b9e\u4f8b<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u53c2\u8003\u9879\u76ee:<a href=\"https:\/\/github.com\/Catherine22\/ClassLoader\">https:\/\/github.com\/Catherine22\/ClassLoader<\/a><\/p><\/blockquote>\n\n\n\n<p>MyDexClassLoader\u7684\u58f0\u660e,\u5173\u6ce8\u7c7b\u7684\u7ee7\u627f\u5173\u7cfb. MyDexClassLoader &lt;- DexClassLoader &lt;- BaseDexClassLoader &lt;- ClassLoader<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">package com.catherine.classloader;<br>\u200b<br>import android.content.Context;<br>import android.util.Log;<br>\u200b<br>import java.net.URL;<br>import java.util.Enumeration;<br>\u200b<br>import dalvik.system.DexClassLoader;<br>\u200b<br>\/**<br> * Created by Catherine on 2017\/2\/13.<br> * yacatherine19@gmail.com<br> *\/<br>\u200b<br>\/**<br> * DexClassLoader:<br> * A class loader that loads classes from .jar and .apk files containing a classes.dex entry.<br> * This can be used to execute code not installed as part of an application.<br> *\/<br>public class MyDexClassLoader extends DexClassLoader {<br> &nbsp; &nbsp;private static final String TAG = \"MyDexClassLoader\";<br>\u200b<br> &nbsp; &nbsp;\/**<br> &nbsp; &nbsp; * @param application MyApplication<br> &nbsp; &nbsp; * @param dexPath &nbsp; &nbsp; String: the list of jar\/apk files containing classes and resources, delimited by File.pathSeparator, which defaults to \":\" on Android<br> &nbsp; &nbsp; * @param soPath &nbsp; &nbsp;  native libraries (path of .so files)<br> &nbsp; &nbsp; * @param classloader the parent class loader<br> &nbsp; &nbsp; *\/<br> &nbsp; &nbsp;public MyDexClassLoader(MyApplication application, String dexPath, String soPath, ClassLoader classloader) {<br> &nbsp; &nbsp; &nbsp; &nbsp;super(dexPath, application.getDir(\"dex\", Context.MODE_PRIVATE).getAbsolutePath(), soPath.replace(\"files\", \"lib\"),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;classloader);<br>\u200b<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"DexClassLoader \" + classloader.toString());<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"dexPath \" + dexPath);<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"optimizedDirectory \" + application.getDir(\"dex\", Context.MODE_PRIVATE).getAbsolutePath());<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"soPath_lib \" + soPath);<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"librarySearchPath \" + soPath.replace(\"files\", \"lib\"));<br>\u200b<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp;@Override<br> &nbsp; &nbsp;protected Class&lt;?&gt; findClass(String name) throws ClassNotFoundException {<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"findClass:\" + name);<br> &nbsp; &nbsp; &nbsp; &nbsp;return super.findClass(name);<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp;@Override<br> &nbsp; &nbsp;public String findLibrary(String name) {<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"findLibrary:\" + name);<br> &nbsp; &nbsp; &nbsp; &nbsp;return super.findLibrary(name);<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp;@Override<br> &nbsp; &nbsp;protected URL findResource(String name) {<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"findResource:\" + name);<br> &nbsp; &nbsp; &nbsp; &nbsp;return super.findResource(name);<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp;@Override<br> &nbsp; &nbsp;protected Enumeration&lt;URL&gt; findResources(String name) {<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"findResources:\" + name);<br> &nbsp; &nbsp; &nbsp; &nbsp;return super.findResources(name);<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp;@Override<br> &nbsp; &nbsp;protected synchronized Package getPackage(String name) {<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.i(TAG, \"getPackage:\" + name);<br> &nbsp; &nbsp; &nbsp; &nbsp;return super.getPackage(name);<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp;@Override<br> &nbsp; &nbsp;public Class&lt;?&gt; loadClass(String name) throws ClassNotFoundException{<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.d(TAG, \"loadClass:\" + name);<br> &nbsp; &nbsp; &nbsp; &nbsp;return super.loadClass(name);<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp;@Override<br> &nbsp; &nbsp;protected Class&lt;?&gt; loadClass(String name, boolean resolve) throws ClassNotFoundException{<br> &nbsp; &nbsp; &nbsp; &nbsp;Log.d(TAG, \"loadClass:\" + name + \" : \" + resolve);<br> &nbsp; &nbsp; &nbsp; &nbsp;return super.loadClass(name, resolve);<br> &nbsp;  }<br>}<\/pre>\n\n\n\n<p>\u770b\u770bDexClassLoader<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">public class DexClassLoader extends BaseDexClassLoader {<br> &nbsp;  \/**<br> &nbsp; &nbsp; * Creates a {@code DexClassLoader} that finds interpreted and native<br> &nbsp; &nbsp; * code.  Interpreted classes are found in a set of DEX files contained<br> &nbsp; &nbsp; * in Jar or APK files.<br> &nbsp; &nbsp; *<br> &nbsp; &nbsp; * &lt;p&gt;The path lists are separated using the character specified by the<br> &nbsp; &nbsp; * {@code path.separator} system property, which defaults to {@code :}.<br> &nbsp; &nbsp; *<br> &nbsp; &nbsp; * @param dexPath the list of jar\/apk files containing classes and<br> &nbsp; &nbsp; * &nbsp; &nbsp; resources, delimited by {@code File.pathSeparator}, which<br> &nbsp; &nbsp; * &nbsp; &nbsp; defaults to {@code \":\"} on Android<br> &nbsp; &nbsp; * @param optimizedDirectory this parameter is deprecated and has no effect<br> &nbsp; &nbsp; * @param librarySearchPath the list of directories containing native<br> &nbsp; &nbsp; * &nbsp; &nbsp; libraries, delimited by {@code File.pathSeparator}; may be<br> &nbsp; &nbsp; * &nbsp; &nbsp; {@code null}<br> &nbsp; &nbsp; * @param parent the parent class loader<br> &nbsp; &nbsp; *\/<br> &nbsp;  public DexClassLoader(String dexPath, String optimizedDirectory,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String librarySearchPath, ClassLoader parent) {<br> &nbsp; &nbsp; &nbsp;  super(dexPath, null, librarySearchPath, parent);<br> &nbsp;  }<br>}<\/pre>\n\n\n\n<p>MyDexClassLoader\u52a0\u8f7dAPK:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Object layerP = new MyDexClassLoader(this, dexPath, cc.getFilesDir().getAbsolutePath(),<br> &nbsp; &nbsp; &nbsp;  (ClassLoader) sm.get()); <\/pre>\n\n\n\n<p>\u4f7f\u7528loadClass\u52a0\u8f7dMyDexClassLoader\u7684class ,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getClassLoader().loadClass(MyConfig.APK2_ACTIVITY_MAIN);<\/pre>\n\n\n\n<p>\u771f\u5b9e\u8c03\u7528\u5230ClassLoader\u7684loadClass<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u4e2a\u95ee\u9898<\/h2>\n\n\n\n<p>\u5728\u4f7f\u7528MyDexClassLoader \u524d\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"50\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-1-1024x50.png\" alt=\"\" class=\"wp-image-387\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-1-1024x50.png 1024w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-1-300x15.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-1-768x38.png 768w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-1.png 1121w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4f7f\u7528MyDexClassLoader\u540e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1002\" height=\"48\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-2.png\" alt=\"\" class=\"wp-image-388\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-2.png 1002w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-2-300x14.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-2-768x37.png 768w\" sizes=\"(max-width: 1002px) 100vw, 1002px\" \/><\/figure>\n\n\n\n<p>\u83ab\u975e\u8fd9\u4e2agetClassLoader\u8fd4\u56de\u7684ClassLoader \u4f1a\u53d8\u5316\u5417\uff1f<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"841\" height=\"118\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-3.png\" alt=\"\" class=\"wp-image-389\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-3.png 841w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-3-300x42.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-3-768x108.png 768w\" sizes=\"(max-width: 841px) 100vw, 841px\" \/><\/figure>\n\n\n\n<p>getClassLoader \u5b98\u7f51\u4ecb\u7ecd\u8fd4\u56de\u7c7b\u7684\u52a0\u8f7d\u5668\uff0c\u7c7b\u6ca1\u53d8\uff0c\u7c7b\u52a0\u8f7d\u5668\u6ca1\u53d8\uff0c\u4f46\u662f\u7c7b\u52a0\u8f7d\u7684\u7ee7\u627f\u5173\u7cfb\u53d8\u4e86\u3002\u3002\u3002\u6709\u70b9\u610f\u601d \u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><a href=\"https:\/\/developer.android.com\/reference\/java\/lang\/Class#getClassLoader()\">https:\/\/developer.android.com\/reference\/java\/lang\/Class#getClassLoader()<\/a><\/p><\/blockquote>\n\n\n\n<p>\u5de7\u7684\u662f\uff0c\u521a\u597d\u51fa\u73b0\u4e86\u4e24\u4e2a\u7ee7\u627f\u5173\u7cfb\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"241\" height=\"301\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-4.png\" alt=\"\" class=\"wp-image-390\"\/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u7528getClassLoader.loadClass(&#8220;com.catherine.resource1.MainActivity&#8221;)\u6216\u8005<\/p>\n\n\n\n<p>getClassLoader.getParent().loadClass(&#8220;com.catherine.resource1.MainActivity&#8221;)\u90fd\u6210\u529fload\u5230\u4e86\u76ee\u6807\u7c7b\u3002<\/p>\n\n\n\n<p>\u4e14\u90fd\u8c03\u7528\u5230MyDexClassLoader\u7684loadClasss\u65b9\u6cd5, \u7b26\u5408\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\uff0c<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"81\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-5-1024x81.png\" alt=\"\" class=\"wp-image-391\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-5-1024x81.png 1024w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-5-300x24.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-5-768x61.png 768w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-5.png 1090w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1006\" height=\"107\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-20220315221448114.png\" alt=\"\" class=\"wp-image-392\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-20220315221448114.png 1006w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-20220315221448114-300x32.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-20220315221448114-768x82.png 768w\" sizes=\"(max-width: 1006px) 100vw, 1006px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"blob:http:\/\/pareto.fun\/5bf8cc14-2dcc-4f5b-9d77-5d4860132ebb\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u53e6\u4e00\u4e2a\u95ee\u9898<\/h2>\n\n\n\n<p>class \u52a0\u8f7d\u6d41\u7a0b\u5462\uff1f<\/p>\n\n\n\n<p>\u660e\u786e\u7ee7\u627f\u5173\u7cfb MyDexClassLoader.getParent == BootClassLoader<\/p>\n\n\n\n<p>\u5728demo\u4e2dMyDexClassLoader\u4e2d\u8c03\u7528getParent\u65b9\u6cd5\u76f4\u63a5\u8fd4\u56de\u4e86BootClassLoader\uff0c<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"blob:http:\/\/pareto.fun\/2e2852f1-544a-4b67-afd1-e95a314cb99b\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u56e0\u4e3a\u7528\u7ee7\u627f\u5173\u7cfb\u65f6\u7ed9\u7684\u53c2\u6570\u5c31\u662fBootClassLoader\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"55\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-7-1024x55.png\" alt=\"\" class=\"wp-image-395\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-7-1024x55.png 1024w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-7-300x16.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-7-768x41.png 768w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-7.png 1159w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><a href=\"https:\/\/blog.csdn.net\/mr_liabill\/article\/details\/50497055\">https:\/\/blog.csdn.net\/mr_liabill\/article\/details\/50497055<\/a><\/p><\/blockquote>\n\n\n\n<p>\u53c2\u8003\u94fe\u63a5\u5f97\u77e5\uff0c \u53cc\u4eb2\u59d4\u6d3e\u5173\u7cfb\u5728\u52a0\u8f7d\u7c7b\u65f6(loadClass) , \u5148\u68c0\u6d4b\u662f\u5426\u5df2\u7ecf\u52a0\u8f7d\u8fc7\u4e86\uff0c\u6ca1\u6709\u52a0\u8f7d\u8fc7\uff0c \u518d\u4ea4\u7ed9\u7236\u7c7b\u52a0\u8f7d\uff1f \uff0c\u4f46\u662f\u8fd9\u91cc\u662fbootClassLoader\u80fd\u662f\u7531\u5b83\u6765\u52a0\u8f7d\u5417\uff0c\u5b83\u52a0\u8f7d\u7684\u8bdd\uff0c\u4e0d\u5c31\u6240\u6709\u7684ClassLoader\u90fd\u53ef\u4ee5\u7528\u4e86\u5417\uff1f\u6000\u7591\u53ef\u80fd\u8fd8\u662f\u6709\u8def\u5f84\u7684\u9650\u5236\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><a href=\"https:\/\/github.com\/huanzhiyazi\/articles\/issues\/30\">https:\/\/github.com\/huanzhiyazi\/articles\/issues\/30<\/a><\/p><\/blockquote>\n\n\n\n<p>\u8fd9\u8fd8\u6709\u4e00\u7bc7\u6bd4\u8f83\u597d\u7684\u6587\u7ae0\u8bb2\u8fd9\u4e2a\u53cc\u4eb2\u59d4\u6258\u673a\u5236\uff0c\u4f46\u662f\u4e5f\u6ca1\u6709\u56de\u7b54android \u53cc\u4eb2\u59d4\u6d3e\u7684\u52a0\u8f7d\u6d41\u7a0b\u3002<\/p>\n\n\n\n<p>\u53ef\u80fd\u5f97\u518d\u770b\u4e0b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u518d\u6765\u4e00\u4e2a\u95ee\u9898<\/h2>\n\n\n\n<p>\u7528\u9ed8\u8ba4ClassLoader\u52a0\u8f7djava.lang.String \u6309\u7167\u6211\u4eec\u7684\u7406\u89e3\uff0c<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"936\" height=\"476\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-8.png\" alt=\"\" class=\"wp-image-396\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-8.png 936w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-8-300x153.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-8-768x391.png 768w\" sizes=\"(max-width: 936px) 100vw, 936px\" \/><\/figure>\n\n\n\n<p>\u4f46\u662f\u5b9e\u9645\u4e0a\u6211\u4eec\u7528loadClass\uff0c<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"101\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-9-1024x101.png\" alt=\"\" class=\"wp-image-397\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-9-1024x101.png 1024w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-9-300x30.png 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-9-768x76.png 768w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-9.png 1192w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>\u76f4\u63a5\u5c31\u8fdb\u884c\u4e86\u8fd4\u56de\uff0c\u751a\u81f3\u6ca1\u6709\u8d70\u5230MyDexClassLoader\uff0c\uff1f\uff1f\uff1f\uff1f<\/p>\n\n\n\n<p>\u53ea\u80fd\u8bf4\u7b97\u662f\u521d\u6b65\u4e86\u89e3\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\uff0c \u540e\u7eed\u719f\u7ec3android\u5e95\u5c42\u8c03\u8bd5\u540e\uff0c\u518d\u5f00\u5c55\u66f4\u7ec6\u8282\u7684\u7814\u7a76\u3002<\/p>\n\n\n\n<p>\u6000\u7591\u7f13\u5b58<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">ART &#8211; Dex\u52a0\u8f7d\u6d41\u7a0b<\/h1>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"604\" height=\"533\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-10.png\" alt=\"\" class=\"wp-image-398\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-10.png 604w, http:\/\/pareto.fun\/wp-content\/uploads\/2022\/04\/image-10-300x265.png 300w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">ART &#8211; \u5b57\u8282\u7801\u52a0\u8f7d\u6d41\u7a0b<\/h1>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ART &#8211; \u53cc\u4eb2\u59d4\u6d3e\u673a\u5236 motivation \u4e86\u89e3\u70ed\u4fee\u590d\u5b9e\u73b0\u673a\u5236\uff0c\u80fd\u591fhook \u70ed\u4fee\u590d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/385"}],"collection":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=385"}],"version-history":[{"count":1,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/385\/revisions"}],"predecessor-version":[{"id":399,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/385\/revisions\/399"}],"wp:attachment":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=385"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}