Add this two permission on manifest 

[java]
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
[/java]

And make sure that permissions are granted.

For marshmallow and later it’s need to implement runtime permission . Here you can get how to use runtime
permission

ANDROID RUNTIME PERMISSION

Leave a Reply

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