JAVA.IO.FILENOTFOUNDEXCEPTION /data/plog.log (permission denied)

If the log shows the exception ‘FileNotFoundException’ with the ‘Permission Denied’,
the root cause of this error is the file is not being granted for write permission.
It means when the user tries to execute an action to write the data into the file and the file does not have a full permission,
this exception will be thrown to tell you that you are trying to perform an action that violating the permission.

You have to add permission in androidManifiest.xml file like as below

<application android:icon=”@drawable/icon” android:label=”@string/app_name”>
<activity android:name=”.WriteCBTextToFileActivity”
android:label=”@string/app_name”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
</application>
<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” />

for example if you are trying to access network state ,, you have to add permission for that .
<uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />

Comments

comments

Leave a Reply

Your email address will not be published. Required fields are marked *