{"id":1541,"date":"2014-08-22T16:10:29","date_gmt":"2014-08-22T08:10:29","guid":{"rendered":"http:\/\/learn-house.idv.tw\/?p=1541"},"modified":"2014-08-22T16:43:08","modified_gmt":"2014-08-22T08:43:08","slug":"android-4-4-kitkat%e7%84%a1%e6%b3%95%e4%bb%bb%e6%84%8f%e4%bd%bf%e7%94%a8mkdir","status":"publish","type":"post","link":"https:\/\/learn-house.idv.tw\/?p=1541","title":{"rendered":"Android 4.4 KitKat\u7121\u6cd5\u4efb\u610f\u4f7f\u7528mkdir?"},"content":{"rendered":"<p>\u524d\u9663\u5b50\u53ea\u8981\u5347\u7d1a\u5230Android 4.4\u5f8c\uff0cAPP\u6709\u4f7f\u7528\u5916\u63a5SDCard\u7684\u4f7f\u7528\u8005\u5c07\u9762\u81e8\u4e00\u9663\u54c0\u9d3b\u904d\u91ce<\/p>\n<p>\u4f60\u7684APP\u5f9e\u6b64\u5c31\u4e0dwork\u4e86.....\u539f\u4f86\uff0cAndroid 4.4 KitKat\uff0cGoogle\u6539\u8b8a\u4e86\u4e00\u4e9b\u5b58\u53d6\u5916\u63a5SDCard\u7684\u7b56\u7565<\/p>\n<p>\u76ee\u7684\u662f\u5e0c\u671b\u6bcf\u500bAPP\u6709\u81ea\u5df1\u79c1\u6709\u7684\u5b58\u53d6\u8def\u5f91\uff0c\u4e5f\u5c31\u662f\u53ea\u80fd\u56fa\u5b9a\u5728<span style=\"color: #ff0000;\"><strong>\/SDCard\/Android\/data\/packageName\/<\/strong><\/span>\u5e95\u4e0b<\/p>\n<p>\u4ee5\u4fbf\u65bc\u7576\u4f60\u505aUninstall APP\uff0c\u6240\u6709\u7684\u5132\u5b58\u8cc7\u6599\u7cfb\u7d71\u624d\u6703\u4e00\u4f75\u5e6b\u4f60\u79fb\u9664<\/p>\n<p>\u4e5f\u5c31\u662f\u8aaa\u8981\u5728\u4f60\u7684packageName\u4e0b\u624d\u80fd\u4f7f\u7528mkdir\u9019\u6a23\u7684\u7a0b\u5f0f\u6307\u4ee4\u5efa\u7acb\u4f60\u8981\u7684\u5b58\u53d6\u8def\u5f91\u8207\u6a94\u6848<\/p>\n<p>\u4f46\u524d\u63d0\u662f\uff0c\u600e\u6a23\u624d\u80fd\u7522\u751f\u9019\u500b<span style=\"color: #ff0000;\"><strong>packageName<\/strong><\/span>\u5728<span style=\"color: #ff0000;\"><strong>\/SDCard\/Android\/data<\/strong><\/span>\u9019\u500b\u8def\u5f91\u4e0b?\u56e0\u70bamkdir\u53ea\u80fd\u7528\u5728packageName\u4e0b\u5440<\/p>\n<p>\u4e0a\u7db2google\u4e86\u4e00\u4e0b\uff0c\u537b\u90fd\u6c92\u6709\u627e\u5230\u6709\u4eba\u8aaa\u8a72\u5982\u4f55\u89e3?<\/p>\n<p><!--more-->\u4e00\u5806\u8aaa\u8981root\u4e4b\u5f8c\u6539\/etc\/permission\u4e0b\u7684platform.xml\u6a94\uff0c\u4f46\u6211\u662f\u958b\u767c\u4eba\u54e1\uff0c\u600e\u9ebc\u6703\u8b93\u4f7f\u7528\u8005\u4f7f\u7528\u6211\u7684app\u9084\u8981\u5148root\u5462?<\/p>\n<p>\u751a\u81f3\u9084\u6709\u4eba\u8aaa\u76ee\u524d\u53ea\u80fd\u7b49goole\u6539API\u624d\u6709\u8fa6\u6cd5\u518d\u505a\u5b58\u53d6\u5916\u63a5SDCard<\/p>\n<p>\u4e5f\u662f\u56e0\u70ba\u9019\u53e5\u8a71\uff0c\u8b93\u6211\u6574\u500b\u601d\u8003\u65b9\u5411\u90fd\u932f\u4e86\uff0c\u958b\u59cb\u5728\u60f3\u662f\u5426\u53ef\u4ee5\u7528\u975e\u6b63\u89e3\u7684\u65b9\u5f0f\u4f86\u89e3\u9019\u500b\u554f\u984c<\/p>\n<p>\u7576\u6642\u6211\u60f3\u5230\u7684\u5c31\u662f\u662f\u5426\u53ef\u4ee5\u5f9e\u5e95\u5c64NDK\u76f4\u63a5\u4e0bLinux\u7684\u6307\u4ee4<\/p>\n<p>\u4f46\u5be6\u969b\u5be6\u4f5c\u5f8c\u9084\u662f\u7121\u6cd5\u5728Android 4.4\u7684Linux\u4e0a\u6b63\u78ba\u57f7\u884cmkdir\u6307\u4ee4<\/p>\n<p>\u900f\u904etool adb.exe\u76f4\u63a5\u9032\u5165\u624b\u6a5f\u53bb\u770b\uff0c\u767c\u73fe\u4ed6\u7684\u5b58\u53d6\u6b0a\u9650\u5982\u4e0b\uff1a<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">shell@K00Y:\/storage\/MicroSD\/Android $ ls -l\r\nls -l\r\ndrwxrwx--x root\u00a0\u00a0\u00a0\u00a0 sdcard_r\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2014-08-22 14:48 data<\/pre>\n<p>\u4e5f\u5c31\u662f\u8aaa\u9664\u4e86root\u5916\uff0c\u80fd\u6709read\u548cwrite\u7684\u6b0a\u9650\u5c31\u53ea\u6709sdcard_r\u9019\u500b\u7fa4\u7d44\u7684\u4f7f\u7528\u8005<br \/>\n\u56e0\u6b64\u4e0a\u5c64APP\u904b\u884c\u7684\u6642\u5019\uff0c\u5b58\u53d6\u6642\u4e0d\u78ba\u5b9a\u662f\u7528\u54ea\u500b\u4f7f\u7528\u8005\u8207\u7fa4\u7d44\uff0c\u4f46\u4e00\u5b9a\u4e0d\u662fsdcard_r\u9019\u500b\u7fa4\u7d44<\/p>\n<p>\u9084\u5728\u601d\u8003\u70ba\u4ec0\u9ebc\u540c\u6642\uff0c\u5c31\u5728Android Developer\u767c\u73fe\u4e00\u7bc7\u91dd\u5c0d<a href=\"http:\/\/developer.android.com\/guide\/topics\/data\/data-storage.html#filesExternal\" target=\"_blank\">External Storage<\/a>\u7684\u4ecb\u7d39<\/p>\n<p>\u88e1\u9762\u6709\u4e00\u6bb5\u662f\u9019\u9ebc\u8aaa\u7684\uff1a<\/p>\n<p>Beginning with Android 4.4, however, you can access both locations by calling  <a href=\"http:\/\/developer.android.com\/reference\/android\/content\/Context.html#getExternalFilesDirs(java.lang.String)\" target=\"_blank\">getExternalFilesDirs()<\/a>,  which returns a <code>File<\/code> array with entries each location.<\/p>\n<p>\u9032\u5165<a href=\"http:\/\/developer.android.com\/reference\/android\/content\/Context.html#getExternalFilesDirs(java.lang.String)\" target=\"_blank\">getExternalFilesDirs()<\/a>\u7684document\u6587\u4ef6\u770b\uff0c\u4ed6\u7684\u63cf\u8ff0\u662f\uff1a<\/p>\n<p>Returns absolute paths to application-specific directories on all external  storage devices where the application can place persistent files it owns. These  files are internal to the application, and not typically visible to the user as  media.<\/p>\n<p>\u4f3c\u4e4e\u597d\u50cf\u8aaa\u4f7f\u7528getExternalFilesDirs()\u9019\u500bAPI\u5c31\u80fd\u56de\u50b3\u6240\u6709\u53ef\u4ee5\u5b58\u53d6\u5230\u7684internal\/external storage\u8def\u5f91<\/p>\n<p>\u56e0\u6b64\u5c31\u62ff\u4f86\u8a66\u8a66\u770b\uff0c\u767c\u73fe\u547c\u53eb\u9019\u500bAPI\u5f8c\uff0c\u4ed6\u81ea\u5df1\u6703\u5728external storage\u5efa\u7acb\u9019\u6a23\u7684\u3127\u500b\u8def\u5f91\/SDCard\/Android\/data\/packageName\/files<\/p>\n<p>\u4e5f\u5c31\u662f\u8aaa\uff0c\u4f60\u8981\u7684<span style=\"color: #ff0000;\"><strong>\/SDCard\/Android\/data\/packageName\/<\/strong><\/span>\u5df2\u7d93\u88ab\u5efa\u51fa\u4f86\u4e86 @@\"<\/p>\n<p>\u9019\u6a23\u7684\u8a71\u5c31\u53ef\u4ee5\u8b93\u4f60\u7684APP\u96a8\u610f\u5728packageName\u4e0b\u5efa\u7acb\u4efb\u4f55\u8cc7\u6599\u593e\u8207\u6a94\u6848\u4e86....(OX\uff0c\u6d6a\u8cbb\u6211\u9019\u9ebc\u591a\u6642\u9593\u5728\u60f3\u600e\u9ebc\u89e3)<\/p>\n<p>\u5f8c\u4f86\u8a66\u7528\u4e86\u4e00\u4e0b\u5982\u679c\u4e0d\u5728Android 4.4\u4ed6\u6703\u5982\u4f55\u904b\u4f5c\uff0c\u7d50\u679c\u767c\u73fe\u547c\u53eb\u9019\u500bAPI\u5f8c\u4ed6\u6703carsh = =\"<\/p>\n<p>\u5728\u4ed4\u7d30\u770b\u4e86\u4e00\u4e0bdocument\u6587\u4ef6\uff0c\u624d\u767c\u73fe\u9019\u500bAPI\u662f\u9069\u7528API level 19(Android 4.4.2)\uff0c\u4e4b\u524d\u7684\u7248\u672c\u662f\u4e0d\u80fd\u76f4\u63a5\u62ff\u4f86\u4f7f\u7528\u7684<\/p>\n<p>\u4f46\u537b\u6709\u4e00\u500b<a href=\"http:\/\/developer.android.com\/reference\/android\/content\/Context.html#getExternalFilesDir(java.lang.String)\" target=\"_blank\">getExternalFilesDir()<\/a>\u8ddf<a href=\"\/reference\/android\/content\/Context.html#getExternalFilesDir(java.lang.String)\"><\/a><a href=\"http:\/\/developer.android.com\/reference\/android\/content\/Context.html#getExternalFilesDirs(java.lang.String)\" target=\"_blank\">getExternalFilesDirs()<\/a>\u5f88\u76f8\u4f3c\u7684API\uff0c\u800c\u4e14\u9069\u7528API level 8(Android 2.2)\u4ee5\u5f8c<\/p>\n<p>\u4f46\u5728Android4.4\u4ee5\u524d\u4f3c\u4e4e\u53ea\u6703\u5efa\u8def\u5f91\u5728primary external filesystem<\/p>\n<p>\u4e0d\u904e\u4e4b\u524d\u7684\u5c31\u6c92\u4ec0\u9ebc\u5f71\u97ff\u4e86\uff0c\u56e0\u70ba\u6211\u5011\u53ef\u4ee5\u81ea\u5df1\u5beb\u7a0b\u5f0f\u4efb\u610fmkdir<\/p>\n<p>\u4e5f\u96e3\u602aAndroid Developer\u6703\u63d0\u5230\u8aaa\u5728Manifest\u52a0\u5165<\/p>\n<pre><span style=\"color: #0000ff;\"><strong>&lt;manifest ...&gt;\r\n &lt;uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"\r\n android:maxSdkVersion=\"18\" \/&gt;\r\n ...\r\n&lt;\/manifest&gt;<\/strong><\/span><\/pre>\n<p>\u5916\u63a5\u5b58\u53d6\u7684\u6b0a\u9650\u6700\u591a\u53ea\u91dd\u5c0dsdk API18\u4ee5\u4e0b\u6709\u6548\u679c\uff0cAPI18\u4e5f\u5c31\u662fAndroid4.4\u9019\u500b\u8a2d\u5b9a\u5df2\u7d93\u4e0d\u662f\u90a3\u9ebc\u91cd\u8981\u4e86<\/p>\n<p>\u56e0\u70baAPI19\u5f8cAndroid\u5df2\u7d93\u4e0d\u9700\u8981\u7d93\u4f7f\u7528\u8005\u540c\u610f\u4e86\uff0cAPP\u5df2\u7d93\u88ab\u9650\u5b9a\u53ea\u80fd\u96a8\u610f\u5b58\u53d6\u8207\u5beb\u5165\u81ea\u5df1packageName\u4e0b\u7684\u8def\u5f91<\/p>\n<p>\u5176\u4ed6\u7684\u5730\u65b9\u4f60\u5c31\u4f11\u60f3\u505a\u5b58\u53d6\u4e86\uff0c\u9019\u6b21\u4e8b\u4ef6\u5f8c\uff0c\u53c8\u4e00\u6b21\u7684\u9ad4\u6703\u5230\u958b\u767c\u6709\u554f\u984c\u9084\u662f\u8981\u5148\u627eAndroid Developer<\/p>\n<p>\u5f88\u591a\u554f\u984c\u7684\u89e3\u6cd5\u90fd\u6703\u5728\u5b98\u65b9\u7684\u6587\u4ef6\u4e2d\u5c31\u5df2\u7d93\u544a\u8a34\u4f60\u4e86....... ~\"~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u9663\u5b50\u53ea\u8981\u5347\u7d1a\u5230Android 4.4\u5f8c\uff0cAPP\u6709\u4f7f\u7528\u5916\u63a5SDCard\u7684\u4f7f\u7528\u8005\u5c07\u9762\u81e8\u4e00\u9663\u54c0\u9d3b\u904d\u91ce \u4f60\u7684APP\u5f9e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1541","post","type-post","status-publish","format-standard","hentry","category-5"],"_links":{"self":[{"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/1541"}],"collection":[{"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1541"}],"version-history":[{"count":0,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/1541\/revisions"}],"wp:attachment":[{"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}