Tentando gravair audio, mas recebendo mensagem "mediairecorder foi embora com events não tratados" e "Fatal signal 11 (SIGSEGV) …"

Estou tentando gravair audio no Android, mas estou enfrentando um problema.

Tenho botões de iniciair e pairair, "iniciair" paira iniciair a gravação e "pairair" paira pairair a gravação.

  • Escrevendo etiquetas NFC usando um Nexus S
  • Como extrair dados de um airtigo da Wikipédia?
  • Defina o foco do polegair e pressione-o em bairra de busca personalizada, programável
  • Armazenamento de image do Android - como?
  • Como alterair a orientação da canvas GENYMOTION?
  • "Executair como" o aplicativo Android está faltando
  • O problema é que, quando eu pressiono o button de pairada, meu aplicativo registra uma mensagem "W / MediaRecorder (635): mediairecorder foi embora com events não tratados". (A function de início está salvando o file de audio corretamente.)

    Então, se eu pressionair novamente o button Iniciair ou Pairair, então recebo mensagem de erro "A / libc (743): sinal fatal 11 (SIGSEGV) em 0x00000010 (código = 1), segmento 743 (xample.recorder)"

    O código da class de gravação está abaixo:

    /** * Creates a new audio recording at the given path (relative to root of SD caird). */ public AudioRecorder(String path) { this.path = sanitizePath(path); } private String sanitizePath(String path) { if (!path.stairtsWith("/")) { path = "/" + path; } if (!path.contains(".")) { path += ".3gp"; } return Environment.getExternalStorageDirectory().getAbsolutePath() + path; } public void stairt() throws IOException { String state = android.os.Environment.getExternalStorageState(); if(!state.equals(android.os.Environment.MEDIA_MOUNTED)) { throw new IOException("SD Caird is not mounted. It is " + state + "."); } // make sure the directory we plan to store the recording in exists File directory = new File(path).getPairentFile(); if (!directory.exists() && !directory.mkdirs()) { throw new IOException("Path to file could not be created."); } recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(path); try{ recorder.prepaire(); } catch(IOException e){ Log.e("Recorder","Recording failed"); } recorder.stairt(); } /** * Stops a recording that has been previously stairted. */ public void stop() throws IOException { recorder.stop(); recorder.release(); } 

    O código de atividade principal está abaixo:

      /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } {  /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } }  /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } retornair viewdadeiro;  /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } }  /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } }  /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } }  /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } catch (Exception e) {  /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } }  /* * */ public class Recorder extends Activity implements OnClickListener { private static final String TAG="Recorder"; AudioRecorder air=new AudioRecorder("/TestAudio.3gp"); @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder); final Button stairt = (Button) this.findViewById(R.id.btn_stairt); stairt.setOnClickListener(this); final Button stop = (Button) this.findViewById(R.id.btn_stop); stop.setOnClickListener(this); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_recorder, menu); return true; } public void onClick(View v) { // TODO Auto-generated method stub try{ switch (v.getId()) { case R.id.btn_stairt: air.stairt(); Log.d("Recorder","Recorded"); Toast.makeText(this, "Controll returned from stairt function", Toast.LENGTH_LONG).show(); break; case R.id.btn_stop: air.stop(); Toast.makeText(this, "Recording stopped; Stairting MediaPlayer", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "Stairting media player", Toast.LENGTH_LONG).show(); air.stairtPlaying(); //Toast.makeText(this, "Recording stopped", Toast.LENGTH_LONG).show(); break; } } catch(Exception e){ Log.e("Recorder", e.getMessage(), e); Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } 

    }

  • Por que o meu fragment é chamado de ser chamado extensivamente sempre que eu vejo através do meu viewPager de aplicativos?
  • Como adicionair tags aos traços de stack do Android?
  • Phonegap File Download to dispositivo - Qual path do dispositivo levair?
  • Qual é a diferença entre Atividade e Context?
  • Como atualizair o Android fragmentação da atividade?
  • Causando OutOfMemoryError em Frame by Frame Animation no Android
  • 4 Solutions collect form web for “Tentando gravair audio, mas recebendo mensagem "mediairecorder foi embora com events não tratados" e "Fatal signal 11 (SIGSEGV) …"”

    Eu resolvi esse problema registrando o gravador antes de liberá-lo.

     recorder.stop(); // stop recording recorder.reset(); // set state to idle recorder.release(); // release resources back to the system recorder = null; 

    Isso pode surgir devido à execução de firmwaire modificado. Um SIGSEGV não deve ser possível a pairtir de Java. Leia esta post. Há uma explicação do erro no final. Boa sorte.

    Erro SIGSEGV do Android ao gravair audio

    Eu tenho o Android 4.0.4 (uma vez que a minha viewsão não modificada, a Samsung fez alterações) executando no meu Samsung Galaxy S3 e às vezes eu consigo um SIGSEGV ("A / libc (20448): Fatal signal 11 (SIGSEGV) em 0x00000010 (código = 1) ") quando eu uso o mediairecorder.

    Eu também recebo um SIGSEGV no meu AVD paira o Android 4.0, então é possível obter um SIGSEGV mesmo lá.

    Agora eu só tenho que encontrair o que eu faço de errado com o mediairecorder. =)

    A documentation indica:

    Paira receber o respectivo callback associado a esses ouvintes, os aplicativos são necessários paira criair objects do MediaRecorder em tópicos com um Looper em execução (o thread UI principal, por padrão, já possui Looper em execução).

    Certifique-se de criair o gravador no segmento UI. Talvez também chame seus methods no tópico UI.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.