java.io.FileNotFoundException: /app.properties: open failed: EROFS (Read-only file system)

StackOverflow https://stackoverflow.com/questions/22403922

سؤال

I would like to create file of format .properties in android app. Unfortunately, I am getting error java.io.FileNotFoundException: /app.properties: open failed: EROFS (Read-only file system) Any idea why?

هل كانت مفيدة؟

المحلول

try to use "android.permission.WRITE_INTERNAL_STORAGE" insert it to AndroidManifest.xml example's below:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.megazy.android"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="17" />

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

نصائح أخرى

Of course you cannot write to a file called

 /app.properties

as that would be located in the top-level or root directory of the device, to which application code will never have write access.

See the Saving Files section of the developer docs to learn about valid places to store a file, and which do and do not require additional attainable permissions.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top