{"id":502,"date":"2023-02-25T14:19:22","date_gmt":"2023-02-25T06:19:22","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=502"},"modified":"2023-04-29T20:48:45","modified_gmt":"2023-04-29T12:48:45","slug":"react-native-learning-how-to-debug","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/react-native-learning-how-to-debug\/","title":{"rendered":"React Native\u5b66\u4e60\u4e4b\u5982\u4f55\u8c03\u8bd5"},"content":{"rendered":"<h2>\u6253\u5f00\u5f00\u53d1\u8005\u83dc\u5355<\/h2>\n<h3>(Android 5.0\u53ca\u4ee5\u4e0a)\u4e0d\u7528\u8bbe\u7f6eip\u548c\u7aef\u53e3\uff1a<\/h3>\n<p>\u5f00\u542fUSB\u8c03\u8bd5\uff0c\u4f7f\u7528<code>adb reverse<\/code>\u547d\u4ee4\uff0c\u8fd0\u884c<\/p>\n<p><!-- more --><\/p>\n<pre><code>adb reverse tcp:8081 tcp:8081<\/code><\/pre>\n<p>\u5373\u53ef\u4f7f\u7528 Reload JS \u548c\u5176\u5b83\u5f00\u53d1\u9009\u9879<\/p>\n<p>\u5927\u90e8\u5206\u73b0\u4ee3\u7684\u5b89\u5353\u8bbe\u5907\u5df2\u7ecf\u6ca1\u6709\u4e86\u786c\u4ef6&quot;Menu&quot;\u6309\u952e\uff0c\u8fd9\u662f\u6211\u4eec\u7528\u6765\u8c03\u51fa\u5f00\u53d1\u8005\u83dc\u5355\u7684\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u53ef\u4ee5\u901a\u8fc7\u6447\u6643\u8bbe\u5907\u6765\u6253\u5f00\u5f00\u53d1\u8005\u83dc\u5355(Reload JS\u3001Debug JS\u2026\u2026)<\/p>\n<h3>(Android 5.0\u4ee5\u4e0b)\u9700\u8981\u8bbe\u7f6eip+\u7aef\u53e3\uff1a<\/h3>\n<p>\u6447\u6643\u8bbe\u5907\uff0c\u6216\u8005\u8fd0\u884c<code>adb shell input keyevent 82<\/code>\uff0c\u53ef\u4ee5\u6253\u5f00\u5f00\u53d1\u8005\u83dc\u5355<\/p>\n<h2>\u8c03\u8bd5\u65b9\u5f0f<\/h2>\n<p>\u5728\u5f00\u53d1\u8005\u83dc\u5355\u4e0a\u70b9\u51fb Debug JS\uff0c\u5219\u81ea\u52a8\u5f00\u542f Chrome \u6d4f\u89c8\u5668\u8fdb\u884c\u8c03\u8bd5\uff0c\u6309\u4e0b F12 \u6253\u5f00\u5f00\u53d1\u8005\u529f\u80fd\uff0c\u53ef\u4ee5\u6267\u884c\uff1a<\/p>\n<p>\uff081\uff09\u8c03\u8bd5\u8f93\u51fa\uff1a<code>console.log();<\/code><\/p>\n<p>\uff082\uff09\u8bbe\u7f6e\u65ad\u70b9breakpoint\uff1a\u67e5\u770b\u53d8\u91cf\u503c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6253\u5f00\u5f00\u53d1\u8005\u83dc\u5355 (Android 5.0\u53ca\u4ee5\u4e0a)\u4e0d\u7528\u8bbe\u7f6eip\u548c\u7aef\u53e3\uff1a \u5f00\u542fUSB\u8c03\u8bd5\uff0c\u4f7f\u7528adb revers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[163],"tags":[],"class_list":["post-502","post","type-post","status-publish","format-standard","hentry","category-react-native"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=502"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/502\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}