{"id":313,"date":"2015-11-07T23:27:13","date_gmt":"2015-11-07T15:27:13","guid":{"rendered":"http:\/\/weitaoc.com\/?p=313"},"modified":"2019-09-27T14:19:25","modified_gmt":"2019-09-27T06:19:25","slug":"react-native%e9%97%ae%e9%a2%98%e9%9b%86%e9%94%a6%ef%bc%8d%e6%8c%81%e7%bb%ad%e6%9b%b4%e6%96%b0","status":"publish","type":"post","link":"http:\/\/weitaoc.com\/?p=313","title":{"rendered":"react-native\u95ee\u9898\u96c6\u9526\uff0d\u6301\u7eed\u66f4\u65b0(2015-12-13)"},"content":{"rendered":"<p><span style=\"font-size: 14pt; font-family: 'arial black', sans-serif;\">1.react native \u4e2dExample\u62a5\u9519\u65e0\u6cd5\u8fd0\u884c<\/span><\/p>\n<p>\u89e3\u51b3\uff1a\u5b98\u65b9\u8bf4\u6cd5\u662f\u7f3a\u5c11\u4ed6\u4eec\u7684\u7c7b\u5e93\uff0c\u7f3a\u5c11\u4ec0\u4e48\u5c31\u4e0b\u8f7d\u4ec0\u4e48\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u5168\u90e8\u68c0\u67e5\u66f4\u65b0\uff0c\u547d\u4ee4\u5982\u4e0b<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">npm install -g<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u4e5f\u53ef\u4ee5\u7f3a\u4ec0\u4e48\u5c31\u4e0b\u8f7d\u4ec0\u4e48<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">npm install --save\u00a0escape-string-regexp<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p><span style=\"font-family: 'arial black', sans-serif; font-size: 14pt;\">2.permission denied, open &#8216;Users\/\u4f60\u7684\u7528\u6237\u540d\/.babel.json&#8217;<\/span><\/p>\n<p>\u6267\u884c\u547d\u4ee4\uff1a<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">sudo chown \u4f60\u7684\u7528\u6237\u540d ~\/.babel.json<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p><span style=\"font-family: 'arial black', sans-serif; font-size: 14pt;\">3.\u6253\u5f00\u6587\u4ef6\u7684\u65f6\u5019\u51fa\u73b0\u7a97\u53e3\u63d0\u793aYou don\u2019t have permission to save the file \u201cproject.xcworkspace\u201d in the folder \u201c****.xcodeproj\u201d<\/span><\/p>\n<p>\u89e3\u51b3\uff1a\u63d0\u793a\u6ca1\u6709\u5199\u6743\u9650\uff0c\u5e76\u8ba9\u4f60\u8bd5\u56fe\u53bbfinder\u6216\u8005\u7ec8\u7aef\u4e2d\u4fee\u6539\u5b83\u3002\u5177\u4f53\u64cd\u4f5c\u5982\u4e0b<\/p>\n<p>\u9009\u4e2d\u5de5\u7a0b\u6587\u4ef6\u5939\u70b9\u53f3\u952e\uff0c\u5728 \u201c\u663e\u793a\u7b80\u4ecb&#8221;\u2014\u2014&gt;&#8221;\u5171\u4eab\u4e0e\u6743\u9650&#8221;\u2014\u2014&gt;&#8221;-+&#8221;\u53f7\u3002 \u6dfb\u52a0\u672c\u7528\u6237\uff08\u5c31\u662f\u4f60\u767b\u5f55\u7684\u90a3\u4e2a\u8d26\u53f7\uff09\uff0c\u6388\u4e88\u8bfb\u5199\u6743\u9650\uff0c\u5e76\u70b9\u51fb\u4e0b\u65b9\u7684\u8bbe\u7f6e\u7b26\u53f7\u9009\u62e9&#8221;\u5e94\u7528\u5230\u5305\u542b\u7684\u9879\u76ee&#8221;\uff0c\u64cd\u4f5c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><a href=\"http:\/\/weitaoc.com\/archives\/313\/2015-11-09-8-36-05\" rel=\"attachment wp-att-326\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-326\" src=\"http:\/\/weitaoc.com\/wp-content\/uploads\/2015\/11\/2015-11-09-8.36.05.png\" alt=\"2015-11-09 8.36.05\" width=\"490\" height=\"392\" \/><\/a><\/p>\n<p><span style=\"font-family: 'arial black', sans-serif; font-size: 14pt;\">4.react-native\u5f15\u5165\u7ec4\u4ef6\u65f6\u7ecf\u5e38\u7f3a\u5305<\/span><\/p>\n<p>\u5728\u5f15\u5165react-native-refreshable-listview\u65f6\uff0c\u62a5\u9519\u627e\u4e0d\u5230is-promise\u3002\u89e3\u51b3\uff1a<\/p>\n<p>\u5230react-native\u76ee\u5f55\u4e0b\u6267\u884c<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">npm install\u00a0is-promise<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u7136\u540e\u5c06is-promise\u590d\u5236\u5230\u5de5\u7a0b\u76ee\u5f55\u4e0b\u9762\uff0c\u542f\u52a8ok\u3002<\/p>\n<p><span style=\"font-family: 'arial black', sans-serif; font-size: 14pt;\">5.react_native run-android \u8fd0\u884c\u65f6\u5f02\u5e38<\/span><\/p>\n<p>\u8c03\u8bd5\u65f6\u9700\u8981\u8fd0\u884c\u8be5\u547d\u4ee4\uff0c\u4f46\u662f\u8fd0\u884c\u65f6\u9700\u8981\u4e0b\u8f7dgradle-2.4-all.zip\uff0c\u8fd9\u4e2a\u5c31\u633a\u6076\u5fc3\u4e86\uff0c\u542c\u8bf4\u662f\u4e2abug\uff0c\u7531\u4e8e\u4f4f\u652f\u6301SSL hosts\u7684\u95ee\u9898\uff0c\u5f02\u5e38\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">Exception in thread &quot;main&quot; java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: \/Users\/weitao\/.gradle\/wrapper\/dists\/gradle-2.4-all\/6r4uqcc6ovnq6ac6s0txzcpc0\/gradle-2.4-all.zip<br \/>\nat org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u89e3\u51b3\u529e\u6cd5\uff1a\u627e\u5230\u4f60react-native\u9879\u76ee\u4e0b android\u76ee\u5f55\uff0c<span class=\"s1\">gradle\/wrapper\uff0c\u4f60\u4f1a\u770b\u5230gradle-wrapper.properties\u8fd9\u4e2a\u6587\u4ef6\uff0c\u6253\u5f00\uff0c\u6539\u4e3a\u5982\u4e0b<\/span><\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">#distributionUrl=https\\:\/\/services.gradle.org\/distributions\/gradle-2.4-all.zip<br \/>\ndistributionUrl=http\\:\/\/services.gradle.org\/distributions\/gradle-2.4-all.zip<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u91cd\u65b0\u8fd0\u884creact_native run-android\uff0c\u4f60\u4f1a\u5f88\u9ad8\u5174\u7684\u770b\u5230gradle\u5f00\u59cb\u4e0b\u8f7d\u4e86\u3002<\/p>\n<p>\u8be6\u60c5\u8bf7\u89c1\uff1a<a href=\"http:\/\/stackoverflow.com\/questions\/29584328\/gradlew-bat-and-gradlew-sslhandshakeexception\" target=\"_blank\" rel=\"noopener noreferrer\">stackoverflow.com<\/a><\/p>\n<p><span style=\"font-family: 'arial black', sans-serif; font-size: 14pt;\">6.Unable to download JS bundle\uff08android \u8c03\u8bd5\u4e0b\uff09<\/span><\/p>\n<p>\u5176\u5b9e\u5b98\u65b9\u7684\u6587\u6863\u4e5f\u8bf4\u4e86\u4e00\u90e8\u5206\uff0c\u4f46\u662f\u6211\u8fd8\u662f\u5728\u8fd9\u4e2a\u4f4d\u7f6e\u5361\u4e86\u4e0d\u5c11\u65f6\u95f4\uff0c\u6211\u7684\u95ee\u9898\u5148\u4e0d\u8bf4\uff0c\u5148\u8bf4\u8bf4\u5b98\u65b9\u6ca1\u6709\u8bf4\u7684\u4e1c\u897f\u3002<\/p>\n<p class=\"p1\"><span class=\"s1\">App \u76f4\u63a5\u90e8\u7f72\u5230\u771f\u673a\uff0c\u7ea2\u8272\u754c\u9762\u62a5\u9519\uff0c\u65e0\u6cd5\u8fde\u63a5\u5230 Debug Server\u3002<\/span><\/p>\n<p class=\"p1\"><span class=\"s1\">\u5982\u679c\u662f 5.0 \u6216\u8005\u4ee5\u4e0a\u673a\u578b\uff0c\u53ef\u901a\u8fc7 adb \u53cd\u5411\u4ee3\u7406\u7aef\u53e3\uff0c\u5c06 Mac \u7aef\u53e3\u53cd\u5411\u4ee3\u7406\u5230\u6d4b\u8bd5\u673a\u4e0a\u3002<\/span><\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">adb reverse tcp:8081 tcp:8081<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p class=\"p1\"><span class=\"s1\">\u5982\u679c 5.0 \u4ee5\u4e0b\u673a\u5668\uff0c\u5e94\u7528\u5b89\u88c5\u5230\u6d4b\u8bd5\u673a\u4e0a\u4e4b\u540e\uff0c\u6447\u52a8\u8bbe\u5907\uff0c\u5728\u5f39\u51fa\u83dc\u5355\u4e2d\u9009\u62e9 Dev Setting &gt; Debug Server host for device\uff0c\u7136\u540e\u586b\u5165 Mac \u7684 IP \u5730\u5740\uff08ifconfig \u547d\u4ee4\u53ef\u67e5\u770b\u672c\u673a IP\uff09\u3002<\/span><\/p>\n<p class=\"p1\">\u597d\u4e86\uff0c\u518d\u8bf4\u6211\u7684\u95ee\u9898\uff0c\u6211\u7684\u6d4b\u8bd5\u673aandroid\u7248\u672c\u662f5.1.1\uff0c\u6267\u884c\u8fc7\u53cd\u5411\u4ee3\u7406\u540e\uff0c\u8fd8\u662f\u4e0d\u884c\uff0c\u7ed1\u5b9aMac\u7684ip\u5730\u5740\u8fd8\u662f\u4e0d\u884c\u3002\u5f7b\u5e95\u5751\u4f4f\u6211\u4e86\u3002\u540e\u6765\u65e0\u610f\u4e4b\u4e2d\uff0c\u6211\u5728\u5f39\u51fa\u7684Dev Setting\u4e2d\u770b\u5230\u8d6b\u7136\u4e00\u884c\u63d0\u793a\uff1aDebug server host &amp; prot for device!&#8230;&#8230;&#8230;&#8230;&#8230;\u6211\u53bb\uff0c\u7f51\u4e0a\u8fd9\u4e9b\u8fc7\u65f6\u7684\u6587\u6863\u8ba9\u6211\u5148\u5165\u4e3a\u4e3b\u7684\u8ba4\u4e3a\u53ea\u9700\u8981server ip\u5c31\u597d\u4e86\uff0c\u5176\u5b9e\u8fd8\u8981\u7aef\u53e3\u7684\u597d\u4e0d\u597d\uff01\uff01\uff01\u586b\u5165server:8081\u7136\u540ereload js\uff0c\u5b8c\u6210\u3002<\/p>\n<p class=\"p1\"><span style=\"font-family: 'arial black', sans-serif; font-size: 14pt;\">7.<span class=\"s1\">Refusing to remove it. Update manually,<\/span><span class=\"s1\">or move it out of the way first.<\/span><\/span><\/p>\n<p class=\"p1\">\u6216\u8005\u4f60\u5173\u6ce8\u7684\u662f<span class=\"s1\">Appears to be a git repo or submodule.\u8fd9\u4e2a\u62a5\u9519\uff0c\u4f46\u662f\u65e0\u8bba\u5982\u4f55\u90fd\u662f\u4e00\u4e2a\u95ee\u9898\u5f15\u8d77\u7684\u3002<\/span><\/p>\n<p class=\"p1\">\u6211\u4eec\u4ecegit clone\u4e00\u4e2amodule\u540e\u653e\u5165\u5f00\u53d1\u7684node module\uff0c\u518d\u4f7f\u7528npm install &#8230; \u4e0b\u8f7d\u65b0\u7684module\u65f6\uff0c\u4f1a\u81ea\u52a8\u68c0\u67e5\u4e0b\u9762\u6240\u6709\u7684module\uff0c\u53d1\u73b0\u4f60\u5176\u4e2d\u7684module\u662f\u4e00\u4e2agit\u5b50\u9879\u76ee\uff0c\u4f1a\u62a5\u9519\uff0c\u4e3a\u4ec0\u4e48\u62a5\u9519\u6211\u5c31\u4e0d\u77e5\u9053\u4e86\uff0c\u89e3\u51b3\u529e\u6cd5\u5c31\u662f\u5220\u9664\u6389module\u5305\u6839\u76ee\u5f55\u4e0b.\/git\u8fd9\u6837\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u5f53\u7136\u8fd9\u4e2a\u6587\u4ef6\u5939\u662f\u9690\u85cf\u7684\uff0c\u7528rm\u547d\u4ee4\u5c31\u884c\u4e86\u3002<\/p>\n<p class=\"p1\"><span style=\"font-family: 'arial black', sans-serif; font-size: 14pt;\">8.You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor<\/span><\/p>\n<p class=\"p1\">\u6211\u4eec\u5728\u8c03\u7528\u6bd4\u8f83\u8001\u7684ios lib\u65f6\uff0c\u4f1a\u53d1\u73b0\u8fd9\u4e2a\u95ee\u9898\uff0c\u6309\u7167\u5e02\u9762\u7684\u8bf4\u6cd5\u662fapple\u63a8\u8350\u4f7f\u7528bitcode\uff0c\u6240\u4ee5\u65b0\u7248\u7684xcode\u9ed8\u8ba4bitcode\u662f\u5f00\u542f\u7684\u3002<\/p>\n<p class=\"p1\">\u89e3\u51b3\u529e\u6cd5\uff1a\u5728build setting\u91cc\u9762\u641c\u7d22 bitcode\uff0c\u5c06enable bitcode\u8bbe\u7f6e\u4e3afalse\u3002<\/p>\n<p><a href=\"http:\/\/weitaoc.com\/archives\/313\/10f45cf7308b738b3ff31cd6b957a950\" rel=\"attachment wp-att-314\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-314\" src=\"http:\/\/weitaoc.com\/wp-content\/uploads\/2015\/11\/10f45cf7308b738b3ff31cd6b957a950.jpg\" alt=\"10f45cf7308b738b3ff31cd6b957a950\" width=\"500\" height=\"306\" \/><\/a><\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"http:\/\/weitaoc.com\">\u8ff7\u8def\u7684\u8001\u9f20<\/a> &raquo; <a href=\"http:\/\/weitaoc.com\/?p=313\">react-native\u95ee\u9898\u96c6\u9526\uff0d\u6301\u7eed\u66f4\u65b0(2015-12-13)<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>1.react native \u4e2dExample\u62a5\u9519\u65e0\u6cd5\u8fd0\u884c \u89e3\u51b3\uff1a\u5b98\u65b9\u8bf4\u6cd5\u662f\u7f3a\u5c11\u4ed6\u4eec\u7684\u7c7b\u5e93\uff0c\u7f3a\u5c11\u4ec0\u4e48\u5c31\u4e0b\u8f7d\u4ec0\u4e48\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u5168\u90e8\u68c0\u67e5\u66f4\u65b0\uff0c\u547d\u4ee4\u5982\u4e0b 1npm install -g \u4e5f\u53ef\u4ee5\u7f3a\u4ec0\u4e48\u5c31\u4e0b\u8f7d\u4ec0\u4e48 1npm install &#8211;save\u00a0esca [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[49],"class_list":["post-313","post","type-post","status-publish","format-standard","hentry","category-other","tag-react"],"views":7136,"_links":{"self":[{"href":"http:\/\/weitaoc.com\/index.php?rest_route=\/wp\/v2\/posts\/313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/weitaoc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/weitaoc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/weitaoc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/weitaoc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=313"}],"version-history":[{"count":20,"href":"http:\/\/weitaoc.com\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":470,"href":"http:\/\/weitaoc.com\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions\/470"}],"wp:attachment":[{"href":"http:\/\/weitaoc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weitaoc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weitaoc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}