Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Crash #22

Open
darknessproduction opened this issue Apr 2, 2021 · 5 comments
Open

Android Crash #22

darknessproduction opened this issue Apr 2, 2021 · 5 comments

Comments

@darknessproduction
Copy link

Hey guys. We have a crash. Can you help us to fix this ?

Crash
Samsung Galaxy Note8
Android 9 (SDK 28)

java.lang.IllegalStateException


java.lang.IllegalStateException: 
  at android.media.MediaRecorder._start (Native Method)
  at android.media.MediaRecorder.start (MediaRecorder.java:1348)
  at com.punarinta.RNSoundLevel.RNSoundLevelModule.start (RNSoundLevelModule.java:68)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:151)
  at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:214)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:764)
@darknessproduction
Copy link
Author

@punarinta @Kammeh @yasithmilinda
Guys please can you look at this?

@darknessproduction
Copy link
Author

darknessproduction commented Apr 19, 2021

I think I fixed it:
kevinresol/react-native-sound-recorder@d4b8b0e

You can use my fork: https://github.com/darknessproduction/react-native-sound-recorder

Use this for android

SoundRecorder.start(SoundRecorder.PATH_CACHE + '/sound.mp4').then(function(){
    SoundRecorder.onNewFrame = (dataWave) => {
        console.log('data', dataWave)
    }
})

@bezenson
Copy link

@darknessproduction Hey, could you explain your fix, please?

@darknessproduction
Copy link
Author

It's crashing on Android 9 sometimes. Here:
at android.media.MediaRecorder.start (MediaRecorder.java:1348)

As I remember it happens because of this:
react-native-sound-recorder/android/src/main/java/com/kevinresol/react_native_sound_recorder/RNSoundRecorderModule.java
constants.put("SOURCE_MIC", MediaRecorder.AudioSource.MIC);

It has to be MediaRecorder.AudioSource.Default on some different phones to be working.
So I used react-native-sound-recorder for android. Because it works very well in ios.

@gavrilikhin-d
Copy link

This is the same as #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants