react-native-voice / voice

:microphone: React Native Voice Recognition library for iOS and Android (Online and Offline Support)
MIT License
1.81k stars 488 forks source link

Facing build error after manually linking in android #476

Open SulthanNK opened 8 months ago

SulthanNK commented 8 months ago

I tried to manually link the package with android base in the readme file documentation and it caused the following build error

Node version: 20.11.0 React native version: both 0.73.3 and 0.72.6 Android version: 11

image.png

MuhammadAhmed-Developer commented 7 months ago

implementation project(':@react-native-community_voice') image After that also show different error that is below image I don't know how to fix this issue If yoou know tell me

codding123vbf commented 7 months ago

same i was also getting error but this library will without any of the manual steps just install it and use it

MuhammadAhmed-Developer commented 7 months ago

same i was also getting error but this library will without any of the manual steps just install it and use it

const SpeechStartHandler =() =>{
    console.log("speech start handler")
}
const SpeechEndHandler =() =>{
    setRecording(false)
    console.log("speech End handler")
}
const SpeechResultsHandler =(e) =>{
    // const recognizedText = e.value[0];
    // console.log("Recognized text:", recognizedText);
    console.log('Resulthandler')
    setResult("How are you?")

}
const SpeechErrorHandler =(e) =>{
    setRecording(false)
    console.log("Error handler:", e)
}

const startRecording = async () =>{
    setRecording(true)
    try{
       await Voice.start("en-US") // en-US
    }catch(err){
        console.log("err", err)
        setRecording(false);
    } 
}

const stopRecording = async () =>{
    try{
        await Voice.stop()
        setRecording(false)
        // fetch responce
    }catch(err){
        console.log("err", err)
    } 
}

useEffect(()=>{
    console.log('use Effect cal')
    Voice.onSpeechStart = SpeechStartHandler;
    Voice.onSpeechEnd = SpeechEndHandler
    Voice.onSpeechResults = SpeechResultsHandler
    Voice.onSpeechError = SpeechErrorHandler

    return () =>{
        // destroy the voice instance
        Voice.destroy().then(Voice.removeAllListeners)
        console.log('Event listeners removed');

    }

},[recording])

I add With out manual steps but the functions is not call when voice start I try couple of time but function is not triggered

codding123vbf commented 7 months ago

same i was also getting error but this library will without any of the manual steps just install it and use it

const SpeechStartHandler =() =>{
    console.log("speech start handler")
}
const SpeechEndHandler =() =>{
    setRecording(false)
    console.log("speech End handler")
}
const SpeechResultsHandler =(e) =>{
    // const recognizedText = e.value[0];
    // console.log("Recognized text:", recognizedText);
    console.log('Resulthandler')
    setResult("How are you?")

}
const SpeechErrorHandler =(e) =>{
    setRecording(false)
    console.log("Error handler:", e)
}

const startRecording = async () =>{
    setRecording(true)
    try{
       await Voice.start("en-US") // en-US
    }catch(err){
        console.log("err", err)
        setRecording(false);
    } 
}

const stopRecording = async () =>{
    try{
        await Voice.stop()
        setRecording(false)
        // fetch responce
    }catch(err){
        console.log("err", err)
    } 
}

useEffect(()=>{
    console.log('use Effect cal')
    Voice.onSpeechStart = SpeechStartHandler;
    Voice.onSpeechEnd = SpeechEndHandler
    Voice.onSpeechResults = SpeechResultsHandler
    Voice.onSpeechError = SpeechErrorHandler

    return () =>{
        // destroy the voice instance
        Voice.destroy().then(Voice.removeAllListeners)
        console.log('Event listeners removed');

    }

},[recording])

I add With out manual steps but the functions is not call when voice start I try couple of time but function is not triggered

on which device you are testing ur code ?

MuhammadAhmed-Developer commented 7 months ago

same i was also getting error but this library will without any of the manual steps just install it and use it

const SpeechStartHandler =() =>{
    console.log("speech start handler")
}
const SpeechEndHandler =() =>{
    setRecording(false)
    console.log("speech End handler")
}
const SpeechResultsHandler =(e) =>{
    // const recognizedText = e.value[0];
    // console.log("Recognized text:", recognizedText);
    console.log('Resulthandler')
    setResult("How are you?")

}
const SpeechErrorHandler =(e) =>{
    setRecording(false)
    console.log("Error handler:", e)
}

const startRecording = async () =>{
    setRecording(true)
    try{
       await Voice.start("en-US") // en-US
    }catch(err){
        console.log("err", err)
        setRecording(false);
    } 
}

const stopRecording = async () =>{
    try{
        await Voice.stop()
        setRecording(false)
        // fetch responce
    }catch(err){
        console.log("err", err)
    } 
}

useEffect(()=>{
    console.log('use Effect cal')
    Voice.onSpeechStart = SpeechStartHandler;
    Voice.onSpeechEnd = SpeechEndHandler
    Voice.onSpeechResults = SpeechResultsHandler
    Voice.onSpeechError = SpeechErrorHandler

    return () =>{
        // destroy the voice instance
        Voice.destroy().then(Voice.removeAllListeners)
        console.log('Event listeners removed');

    }

},[recording])

I add With out manual steps but the functions is not call when voice start I try couple of time but function is not triggered

on which device you are testing ur code ?

Android oppo a54

codding123vbf commented 7 months ago

same i was also getting error but this library will without any of the manual steps just install it and use it

const SpeechStartHandler =() =>{
    console.log("speech start handler")
}
const SpeechEndHandler =() =>{
    setRecording(false)
    console.log("speech End handler")
}
const SpeechResultsHandler =(e) =>{
    // const recognizedText = e.value[0];
    // console.log("Recognized text:", recognizedText);
    console.log('Resulthandler')
    setResult("How are you?")

}
const SpeechErrorHandler =(e) =>{
    setRecording(false)
    console.log("Error handler:", e)
}

const startRecording = async () =>{
    setRecording(true)
    try{
       await Voice.start("en-US") // en-US
    }catch(err){
        console.log("err", err)
        setRecording(false);
    } 
}

const stopRecording = async () =>{
    try{
        await Voice.stop()
        setRecording(false)
        // fetch responce
    }catch(err){
        console.log("err", err)
    } 
}

useEffect(()=>{
    console.log('use Effect cal')
    Voice.onSpeechStart = SpeechStartHandler;
    Voice.onSpeechEnd = SpeechEndHandler
    Voice.onSpeechResults = SpeechResultsHandler
    Voice.onSpeechError = SpeechErrorHandler

    return () =>{
        // destroy the voice instance
        Voice.destroy().then(Voice.removeAllListeners)
        console.log('Event listeners removed');

    }

},[recording])

I add With out manual steps but the functions is not call when voice start I try couple of time but function is not triggered

on which device you are testing ur code ?

Android oppo a54

what android version ?

MuhammadAhmed-Developer commented 7 months ago

same i was also getting error but this library will without any of the manual steps just install it and use it

const SpeechStartHandler =() =>{
    console.log("speech start handler")
}
const SpeechEndHandler =() =>{
    setRecording(false)
    console.log("speech End handler")
}
const SpeechResultsHandler =(e) =>{
    // const recognizedText = e.value[0];
    // console.log("Recognized text:", recognizedText);
    console.log('Resulthandler')
    setResult("How are you?")

}
const SpeechErrorHandler =(e) =>{
    setRecording(false)
    console.log("Error handler:", e)
}

const startRecording = async () =>{
    setRecording(true)
    try{
       await Voice.start("en-US") // en-US
    }catch(err){
        console.log("err", err)
        setRecording(false);
    } 
}

const stopRecording = async () =>{
    try{
        await Voice.stop()
        setRecording(false)
        // fetch responce
    }catch(err){
        console.log("err", err)
    } 
}

useEffect(()=>{
    console.log('use Effect cal')
    Voice.onSpeechStart = SpeechStartHandler;
    Voice.onSpeechEnd = SpeechEndHandler
    Voice.onSpeechResults = SpeechResultsHandler
    Voice.onSpeechError = SpeechErrorHandler

    return () =>{
        // destroy the voice instance
        Voice.destroy().then(Voice.removeAllListeners)
        console.log('Event listeners removed');

    }

},[recording])

I add With out manual steps but the functions is not call when voice start I try couple of time but function is not triggered

on which device you are testing ur code ?

Android oppo a54

what android version ?

Android version 11

codding123vbf commented 7 months ago

same i was also getting error but this library will without any of the manual steps just install it and use it

const SpeechStartHandler =() =>{
    console.log("speech start handler")
}
const SpeechEndHandler =() =>{
    setRecording(false)
    console.log("speech End handler")
}
const SpeechResultsHandler =(e) =>{
    // const recognizedText = e.value[0];
    // console.log("Recognized text:", recognizedText);
    console.log('Resulthandler')
    setResult("How are you?")

}
const SpeechErrorHandler =(e) =>{
    setRecording(false)
    console.log("Error handler:", e)
}

const startRecording = async () =>{
    setRecording(true)
    try{
       await Voice.start("en-US") // en-US
    }catch(err){
        console.log("err", err)
        setRecording(false);
    } 
}

const stopRecording = async () =>{
    try{
        await Voice.stop()
        setRecording(false)
        // fetch responce
    }catch(err){
        console.log("err", err)
    } 
}

useEffect(()=>{
    console.log('use Effect cal')
    Voice.onSpeechStart = SpeechStartHandler;
    Voice.onSpeechEnd = SpeechEndHandler
    Voice.onSpeechResults = SpeechResultsHandler
    Voice.onSpeechError = SpeechErrorHandler

    return () =>{
        // destroy the voice instance
        Voice.destroy().then(Voice.removeAllListeners)
        console.log('Event listeners removed');

    }

},[recording])

I add With out manual steps but the functions is not call when voice start I try couple of time but function is not triggered

on which device you are testing ur code ?

Android oppo a54

what android version ?

Android version 11

add this in ur manifest file to make it work on android 11