-
Notifications
You must be signed in to change notification settings - Fork 31
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
getSupportedVoices() #112
Comments
same problem on speak method. |
I have a working fix but am not a contributor and i dont know how to do this or publish/suggest a fix etc... or step on anyones toes! Its because you cant or shouldn't compare by using a hashcode. For now i just edit the TextToSpeech.java file locally by changing the getSupportedVoices method/function see below... if someone can get it to work and update the plugin would be great... my 2 cents and thanks! :)
|
PRs are welcome! |
@mar10droid3v A little surprised to see an issue here - hashCode should be constant for any given object, so transitivity should be preserved. Have you logged the hashCodes and taken a look at what is going on there? A consistent sorting mechanism is needed, but the mechanism itself is irrelevant, so name should be totally fine. As for now, if you don't use the voice selection everything will work just fine. |
@mar10droid3v @migmax48 |
@ecc521 hey tucker. happens on xiaomi devices. using name fixed it. |
@ecc521 Hi Tucker. |
@ecc521 Same issue here on a Samsung SM-X210 tablet. The plugin works after the tablet is factory reset. The issue starts after changing the default TTS from Samsung Voice to Google Voice on System settings. Changing it back to Samsung TTS stops the error. Sending plugin error: {"save":false,"callbackId":"85276539","pluginId":"TextToSpeech","methodName":"getSupportedVoices","success":false,"error":{"message":"Comparison method violates its general contract!"}} I've also tested @mar10droid3v solution and it works well. |
Fixes capacitor-community#112 Changes compare logic to avoid the issue described without changing the ordering behavior.
…114) * fix(android) Error: Comparison method violates its general contract! Fixes a runtime crash on getSupportedVoices observed on Android after changing the default TTS from Samsung to Google from system settings. Stack: @capacitor-community/text-to-speech: 4.0.0, @capacitor/android : 6.0.0 @ionic/angular:7.8.6 Traces: Sending plugin error: {"save":false,"callbackId":"72380935","pluginId":"TextToSpeech","methodName":"getSupportedVoices","success":false,"error":{"message":"Comparison method violates its general contract!"}} * fix(android) Error: Comparison method violates its general contract! revisited This change to the solution keeps the behavior 100% consistent with original code that orders based on hash instead of name Fixes a runtime crash on getSupportedVoices observed on Android after changing the default TTS from Samsung to Google from system settings. Stack: @capacitor-community/text-to-speech: 4.0.0, @capacitor/android : 6.0.0 @ionic/angular:7.8.6 Traces: Sending plugin error: {"save":false,"callbackId":"72380935","pluginId":"TextToSpeech","methodName":"getSupportedVoices","success":false,"error":{"message":"Comparison method violates its general contract!"}} * fix(android) Error: Comparison method violates its general contract! Fixes #112 Changes compare logic to avoid the issue described without changing the ordering behavior. --------- Co-authored-by: Henrique Latorre <[email protected]>
Plugin version:
@capacitor-community/text-to-speech": "^3.0.1
Platform(s):
android 12
Current behavior:
Hi when testing on a real device TextToSpeech.getSupportedVoices() is returning error, "Comparison method violates its general contract!"
Any ideas?
The text was updated successfully, but these errors were encountered: