你好我在lg urbane上开发app to android wear,我试着录制Sound 使用此代码:
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(PATH_NAME);
recorder.prepare();
recorder.start();
premission:
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.BODY_SENSORS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK" />
LOG cat:
03-03 13:17:13.150 16423-16423/com.example.s.smart E/MediaRecorder: start failed: -2147483648
03-03 13:17:13.151 16423-16423/com.example.s.smart D/AndroidRuntime: Shutting down VM
03-03 13:17:13.151 16423-16423/com.example.s.smart E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.s.smart, PID: 16423
java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at com.example.omri.s.WatchOut$1.onFinish(WatchOut.java:116)
at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:127)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
检查问题:
和所有谷歌搜索
尝试此选项:
recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB);
尝试从AudioManeger
重新获取fucos我认为okGoogle阻止了我的麦克风,并试图重新推出fucos,但是 仍然没有工作
手表23的Android V