Android 为系统设置文件分配权限

Android 为系统设置文件分配权限,android,Android,我正在尝试为我创建的用于设置系统设置的文件分配权限。我在线收到Io异常 inputStream=context.getAssets().open(fileName); 在我的清单文件中,我已使用 <uses-permission android:name="android.permission.WRITE_SETTINGS"/> 您是否尝试过写入安全设置 或者可能是指定错误的文件路径。您可能需要发布更具体的代码。您是否尝试过编写安全设置 或者可能是指定错误的文件路径。您可能需要发

我正在尝试为我创建的用于设置系统设置的文件分配权限。我在线收到Io异常

inputStream=context.getAssets().open(fileName);
在我的清单文件中,我已使用

<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

您是否尝试过写入安全设置


或者可能是指定错误的文件路径。您可能需要发布更具体的代码。

您是否尝试过编写安全设置


或者可能是指定错误的文件路径。您可能需要发布更具体的代码。

好的。。发现错误。创建的系统设置文件应该保存在assets目录中,而不是其他任何地方。我很愚蠢,没有事先阅读它。。发现错误。创建的系统设置文件应保存在assets目录中,而不是其他任何位置。我很愚蠢,没有事先阅读它。

我已添加了2个权限更多::仍然没有结果我将添加2个权限更多::仍然没有结果
public boolean copyConfigFile(String fileName) throws IOException {
        File configFile = new File(systemDir, fileName);
        Log.d(getClass().getSimpleName(), "Config file path :" + configFile.getAbsolutePath());
        Log.d(getClass().getSimpleName(), "FILE NAME::" + fileName);
        if(!configFile.exists()){
            configFile.createNewFile();
            InputStream is = null;
            OutputStream os = null;
            try {
                is = ctx.getAssets().open(fileName);
                os = new FileOutputStream(configFile);
                byte []fileBytes = new byte[is.available()];
                is.read(fileBytes);
                os.write(fileBytes);
                Log.d(getClass().getSimpleName(), "File copied.");
                return true;
            } finally {
                if(is != null){
                    is.close();
                }
                if(os != null){
                    os.close();
                }
            }
        }else{
            Log.d(getClass().getSimpleName(), "File already exist.");
            return true;
        }
    }