Re: [問題] 關於在SD卡裡面建立資料夾

看板AndroidDev作者 (skill)時間10年前 (2014/03/12 13:14), 編輯推噓2(207)
留言9則, 4人參與, 最新討論串2/2 (看更多)
我大概可能也遇到跟這位大大一樣的問題QQ 我在new htc one上 (4.4.2)建立資料夾時候失敗 可是在其他手機卻成功 orz 那位大大說是手機的問題 那請問要怎樣才能成功建立資料夾呢? 話說htc new one升到4.3以後,Eclipse就讀不到手機了orz 這跟我是用手動安裝APK到手機上有關嗎? 謝謝! 附上程式碼: public static String getAppDirectory(){ return Environment.getExternalStorageDirectory() + File.separator + "AppFolder" + File.separator + "images"; } public static File getOutputMediaFile(Context context){ File mediaStorageDir = new File( getVideoDirectory()); if( !mediaStorageDir.exists()){ if( !mediaStorageDir.mkdirs()){ return null; } } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.21.125.247 ... 已解決 http://developer.android.com/guide/topics/manifest/ uses-permission-element.html 這次不是被 android document 陰了就是被 HTC陰了! 明明 document說 ”This way, beginning with API level 19, the system will no longer grant your app the WRITE_EXTERNAL_STORAGE permission.” htc 4.4.2 api 19 的情況下還是要此 permission啊! 把 permission的 android:maxSdkVersion="18" 拿掉就ok了 G________G" ※ 編輯: issuemylove 來自: 211.21.125.247 (03/12 16:37)

03/12 22:21, , 1F
google指的應該只有getExternalFilesDir() 並不是所有SD空間
03/12 22:21, 1F

03/12 22:46, , 2F
升到4.3之後Eclipse讀不到是因為4.3的adb有進階保護
03/12 22:46, 2F

03/12 22:47, , 3F
插上去之後裝置應該會跳出一個東西 按信任就對了
03/12 22:47, 3F

03/13 12:24, , 4F
沒有耶 囧 我始終沒看到問我信任的dialog
03/13 12:24, 4F

03/13 12:24, , 5F
有甚麼辦法可以主動打開它嗎?
03/13 12:24, 5F

03/13 20:40, , 6F
你電腦端是以最高權限管理者身份嗎?
03/13 20:40, 6F

03/14 09:55, , 7F
Eclipse開啟的時候嗎? 是的 本身windows帳號也是
03/14 09:55, 7F

03/14 09:55, , 8F
系統管理者權限
03/14 09:55, 8F

03/20 19:48, , 9F
如果電腦有抓到的話直接cmd打開輸入adb shell應該就會問你了
03/20 19:48, 9F
文章代碼(AID): #1J7-rJy3 (AndroidDev)
文章代碼(AID): #1J7-rJy3 (AndroidDev)