hyochan / react-native-audio-recorder-player

react-native native module for audio recorder and player.
MIT License
715 stars 213 forks source link

Audio recording does not working on Android 11 and above #410

Open CRupesh opened 2 years ago

CRupesh commented 2 years ago

Version of react-native-audio-recorder-player : 3.3.0

Version of React Native : 0.63.2

Platforms you faced the error (IOS or Android or both?) : Android 11

Expected behavior

It should support the recording obviously for Android 11 and above. Audio recording working fine on Android 10 and below

Actual behavior

Whenever I start recording audio, it stuck at "startRecorder" method

Code snippet for recording audio


const audioSet = { AudioEncoderAndroid: AudioEncoderAndroidType.AAC, AudioSourceAndroid: AudioSourceAndroidType.MIC, AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high, AVNumberOfChannelsKeyIOS: 2, AVFormatIDKeyIOS: AVEncodingOption.aac, };

const uri = await audioRecorderPlayer.startRecorder(path, audioSet, false);


My android project configuration is

buildscript { ext { buildToolsVersion = "29.0.3" minSdkVersion = 24 compileSdkVersion = 29 targetSdkVersion = 30 kotlinVersion = "1.5.31" } repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:3.5.4") classpath 'com.google.gms:google-services:4.3.10' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } }

hyochan commented 2 years ago

What happens if you change the config to below? 🤔

ext {
buildToolsVersion = "30.0.3"
minSdkVersion = 24
compileSdkVersion = 30
targetSdkVersion = 30
kotlinVersion = "1.5.31"
pietroanello commented 2 years ago

What happens if you change the config to below? 🤔

ext {
buildToolsVersion = "30.0.3"
minSdkVersion = 24
compileSdkVersion = 30
targetSdkVersion = 30
kotlinVersion = "1.5.31"

This fixed the problem for me on Android 11. To be more accurate i just changed the kotlin version from 1.5.0 to 1.5.31