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

Unfortunately app has stopped working #19

Closed
sudhanshu6247 opened this issue Nov 12, 2016 · 13 comments
Closed

Unfortunately app has stopped working #19

sudhanshu6247 opened this issue Nov 12, 2016 · 13 comments

Comments

@sudhanshu6247
Copy link

whenever I tap on microphone and call the _buttonClick() function, it records voice for 2 seconds and then app gets crashed, giving error "unfortunately app has stopped working"
please help.

@JoaoCnh
Copy link
Owner

JoaoCnh commented Nov 15, 2016

Are you testing on a device? Which version of Android are you using?

Which versions of React-Native and such are you using?

I'm severely limited to which devices I can test with.

@happierco
Copy link

Same here. Testing on Samsung Note5, if no speech recognized I can try again but if it captures something, app crashes right after with the exception below.

(also crashes when there is a backdrop touch)

Shutting down VM

FATAL EXCEPTION: main
Process: com.voicerecognition, PID: 9872
java.lang.AbstractMethodError: abstract method "void com.facebook.react.bridge.ActivityEventListener.onActivityResult(android.app.Activity, int, int, android.content.Intent)"

	at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:260)
	at com.facebook.react.XReactInstanceManagerImpl.onActivityResult(XReactInstanceManagerImpl.java:627)
	at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:135)
	at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:77)
	at android.app.Activity.dispatchActivityResult(Activity.java:7137)
	at android.app.ActivityThread.deliverResults(ActivityThread.java:4921)
	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4968)
	at android.app.ActivityThread.access$1600(ActivityThread.java:222)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1849)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:158)
	at android.app.ActivityThread.main(ActivityThread.java:7229)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

@JoaoCnh
Copy link
Owner

JoaoCnh commented Nov 21, 2016

I'll investigate as soon as I can. It may need some updates because of React Native versions.

@sudhanshu6247
Copy link
Author

I was testing it on android device. In my case problem was due to 'ToastAndroid', when I removed 'ToastAndroid', it started working fine.

@JoaoCnh
Copy link
Owner

JoaoCnh commented Dec 10, 2016

Ok @sudhanshu6247 that's actually helpful to know.

@azraelti
Copy link

@JoaoCnh , Hey, is there any updates for this?

@kunsachdeva
Copy link

@sudhanshu6247 is this working for you now? I'm facing the same issue.
Which "ToastAndroid" are you talking about exactly?

@de-code
Copy link

de-code commented Jan 11, 2017

Perhaps should be raised as a separate issue. The original issue seem to be a JS error in the user's code.

I've created a PR for the onActivityResult issue (which is due to a react native change)

@sudhanshu6247
Copy link
Author

sudhanshu6247 commented Jan 17, 2017

@kunal95 yup, this is working for me. Original code was:

 async _buttonClick(){
try{
    //More Locales will be available upon release.
    var spokenText = await SpeechAndroid.startSpeech("Speak yo", SpeechAndroid.GERMAN);
    ToastAndroid.show(spokenText , ToastAndroid.LONG);
}catch(error){
    switch(error){
        case SpeechAndroid.E_VOICE_CANCELLED:
            ToastAndroid.show("Voice Recognizer cancelled" , ToastAndroid.LONG);
            break;
        case SpeechAndroid.E_NO_MATCH:
            ToastAndroid.show("No match for what you said" , ToastAndroid.LONG);
            break;
        case SpeechAndroid.E_SERVER_ERROR:
            ToastAndroid.show("Google Server Error" , ToastAndroid.LONG);
            break;
        /*And more errors that will be documented on Docs upon release*/
    }
}

}

I just removed ToastAndroid from each line.

My code is

       async _buttonClick(){
try{
    //More Locales will be available upon release.
    var text = await SpeechAndroid.startSpeech("Speak your message", SpeechAndroid.ENGLISH);
    this.props.sendMessage(text);
    console.log("spokenText", spokenText);
}catch(error){
  console.log("spokenText", error);
    switch(error){
        case SpeechAndroid.E_VOICE_CANCELLED:
            break;
        case SpeechAndroid.E_NO_MATCH:
            break;
        case SpeechAndroid.E_SERVER_ERROR:
            break;
        /*And more errors that will be documented on Docs upon release*/
    }
}
}

@kunsachdeva
Copy link

@sudhanshu6247 Thats's weird. I'm using RN 0.40.0 and I had to do bunch of changes in onActivityResult and add BaseActivityEventListener object to the module.

@JoaoCnh
Copy link
Owner

JoaoCnh commented Mar 8, 2017

I've just published v0.5.0. Please check if issues still persist for any of you and please feel free to report new ones.

Many thanks to everyone who contributed for v0.5.0 with PRs

@JoaoCnh
Copy link
Owner

JoaoCnh commented Mar 22, 2017

@kunal95 @sudhanshu6247 @de-code @azraelti Anyone try v0.5.0? Can this issue be closed?

@JoaoCnh
Copy link
Owner

JoaoCnh commented Apr 21, 2017

@kunal95 @sudhanshu6247 @de-code @azraelti v0.5.1 has been published. If it works well I'll close this issue. Feel free to re-open

@JoaoCnh JoaoCnh closed this as completed Apr 21, 2017
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

6 participants