简体   繁体   English

Nexus 6 Environment.getExternalStorageDirectory() 无法创建目录外部存储

[英]Nexus 6 Environment.getExternalStorageDirectory() cannot create directory External storage

I have a Nexus 6(Google Fi) I got an app that works on all other devices I tested but not on this one.我有一个 Nexus 6(Google Fi) 我有一个应用程序可以我测试过的所有其他设备上运行但不能在这个设备上运行。 Trying to create a directory or a file under this GetExternalStorageDirectory() is not working;尝试在此 GetExternalStorageDirectory() 下创建目录或文件不起作用; I have tried mkdirs() as well.我也试过 mkdirs() 。 I cannot see the emulated/0 folder from my FileExplorer(on the phone) or from my PC(W10).我无法从我的 FileExplorer(在手机上)或我的 PC(W10)中看到 emulated/0 文件夹。 And yes I do have the manifest permission for writing files.是的,我确实拥有写入文件的清单权限。 Using the following...使用以下...

---Definition
public static String currentdirectory=Environment.getExternalStorageDirectory() + "/ADAK";
---Code snipplet
    sd = new File(G.currentdirectory);
    if (!sd.exists() && !sd.isDirectory()) {
        if (!sd.mkdir()) {
            G.WTL("Cannot create ADAK directory");
            G.WTS(this, "Cannot create ADAK directory");
            System.exit(0);
        }
    }

Android 6.0 Marshmallow using API 23 have a new requirement, permissions must be requested each time the application starts.使用 API 23 的 Android 6.0 Marshmallow 有一个新要求,每次应用程序启动时都必须请求权限。 All of this is well documented by Google.所有这些都被 Google 很好地记录在案。 http://developer.android.com/training/permissions/requesting.html http://developer.android.com/training/permissions/requesting.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Environment.getExternalStorageDirectory()=内部目录 - Environment.getExternalStorageDirectory() = internal directory 不推荐使用 environment.getexternalstoragedirectory() 后如何访问外部存储 - How to get access to external storage since environment.getexternalstoragedirectory() is deprecated Environment.getExternalStorageDirectory()获取硬件存储 - Environment.getExternalStorageDirectory() get hardware Storage Environment.getExternalStorageDirectory()。getAbsolutePath()无法正常工作并提供/存储 - Environment.getExternalStorageDirectory().getAbsolutePath() not working and giving /storage 到 Environment.getExternalStorageDirectory() 还是不? - To Environment.getExternalStorageDirectory() or not to? Environment.getExternalStorageDirectory()无法正常工作 - Environment.getExternalStorageDirectory() not working Environment.getExternalStorageDirectory() 已弃用 - Environment.getExternalStorageDirectory() is depreceated Environment.getExternalStorageDirectory不返回可移动存储的路径 - Environment.getExternalStorageDirectory does not return the path to the removable storage Environment.getExternalStorageDirectory()和Environment.getExternalStorageDirectory()。getAbsolutePath()之间的区别 - Difference between Environment.getExternalStorageDirectory() and Environment.getExternalStorageDirectory().getAbsolutePath() Environment.getExternalStorageDirectory()在Android中不起作用 - Environment.getExternalStorageDirectory() not working in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM