错误提示
E/AudioEffect: set(): AudioFlinger could not create effect, status: -1
添加权限
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.INTERNET"/>
发现仍然报错,于是去Activity请求权限。
void GetAudioPermission() {if (!CheckAudioPermission()) {ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.RECORD_AUDIO}, 2);}}boolean CheckAudioPermission() {boolean bGranted = true;//判断当前是否已授权if(ContextCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED){bGranted = false;}return bGranted;}void GetInterNetPermission() {if (!CheckInterNetPermission()) {ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.INTERNET, Manifest.permission.MODIFY_AUDIO_SETTINGS}, 2);}}boolean CheckInterNetPermission() {boolean bGranted = true;if(ContextCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED){bGranted = false;}if(ContextCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.MODIFY_AUDIO_SETTINGS) != PackageManager.PERMISSION_GRANTED){bGranted = false;}return bGranted;}