Code on android does not work

Hi

I’ve got this code, it’s AT&T speech rec. It works on unity but not in android, any ideas why?? It builds for android fine and works, it playbacks the sound but then the label doesn’t get input from AT&T API i think. Maybe something wrong in android with the file saving???

// Label for speech
        SpeechLbl = GameObject.Find ("SpeechLabel").GetComponent<UILabel> ();

        // Start microphone, wait 5 seconds then end recording.
        GetComponent<AudioSource>().clip = Microphone.Start (null,false,5,8000);
        yield return new WaitForSeconds(5);
        Microphone.End(null);

        // Playback what we've got.
        GetComponent<AudioSource>().Play();

        // Generate audio data clip.
        float[] clipData = new float[GetComponent<AudioSource>().clip.samples * GetComponent<AudioSource>().clip.channels];
        GetComponent<AudioSource>().clip.GetData(clipData,0);
        WaveGen.WaveFormatChunk format = new WaveGen().MakeFormat(GetComponent<AudioSource>().clip);

        // Create a file in local app path.
        string filename = "recordedSpeech.wav";
        filePath = Application.persistentDataPath + "/" + filename;
        FileStream stream = File.OpenWrite(filePath);
        new WaveGen().Write (clipData,format,stream);
        stream.Close();

        // Check response from AT&T API and save in speech label.
        SpeechResponse response = requestFactory.SpeechToText (filePath);
        string transcribedText = response.Recognition.NBest[0].ResultText;
        SpeechLbl.text = transcribedText;

Generally, “It doesn’t work” is nearly impossible to debug. Are you getting console errors on your Android build? Have you tried liberally throwing in Debug.Log() messages to see where things are falling apart?

Anyone please

The code stops on these, they don’t get executed…

string transcribedText = response.Recognition.NBest[0].ResultText;
Debug.Log ("Add it to label");
SpeechLbl.text = transcribedText;

error:

NullReferenceException: Object reference not set to an instance of an object.
VoiceRec+c__Iterator17.MoveNext() (at Assets/VoiceRec.cs:66)