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

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

Pergunta

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?

Foi útil?

Solução

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" />

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top