AudioFlinger could not create record track, status: -1 , Need help to ifx

痞子三分冷 提交于 2019-12-03 11:14:51

Add record_audio permission to AndroidManifest.xml

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

On recent Android versions, it seems that repushing the apk from Android Studio after changing the permissions in the manifest doesn't actually change the permission in the app settings. This is why the above answer worked for me. I had built an application without the RECORD_AUDIO permission in my manifest, and seen the permission error in my log (along with the errors in the OP). I added the permission to my manifest and reran the application on device, the permission error in the log was no longer there but I still got the errors in the OP. I went to my System, Applications, Application Manager -> MyApp -> Permissions, and saw that Record Audio was listed but still turned off. Manually turning that on fixed it.

I imagine (but haven't confirmed) that if I built the correct permission into my manifest in the first place, this would have just worked for me. Alternatively, uninstalling my app from the device, and then reinstalling, might fix too, but I haven't tried that either.

Solution for Pre-Marshmallow versions of android will be same as Olexij mentioned...

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

However as starting Android API 23 (Marshmallow) this is considered and dangerous permission and you have to request for this permission from within the Activity where it is being used. Dave's experience is result of that; if you declare permission in Manifest but do not request at runtime (atleast first time) then it will show in App Permissions in Application Manager but will stay turned off.

Check...

The solution for API 23 (Marshmallow) is simple. You must set "targetSdkVersion 22" in the bulid.gradle file, after get bellow permission.

Jint

Giving Explicit Permission fixed the issue for me.

Try these steps

Android Version 7.0
Settings -> Applications -> <MyAPP> -> Permissions 
-> [Turn Camera and Microphone ON]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!