java.lang.RuntimeException:}活性MainActivityを再開することができません: java.lang.IllegalStateExceptionに起因:android.media.MediaPlayer.prepareで java.lang.IllegalStateException( com.example.caneraydin.androidwithlogin.MainActivity.onResume(MainActivity.java:138)アンドロイド音声メディアプレーヤのIllegalStateExceptionが無音声
でネイティブメソッド) このコード
@Override
public void onResume() {
super.onResume();
MediaPlayer mMediaPlayer = new MediaPlayer();
mMediaPlayer = MediaPlayer.create(this,R.raw.mainactivitymp3);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setLooping(true);
try {
mMediaPlayer.prepare();
Log.d(TAG,"mainonresumemediaplayer");
} catch (IOException e) {
Log.d(TAG,"mainonresume mediaplayer error");
e.printStackTrace();
}
mMediaPlayer.start();//.release();// STOPSHIP: 6/2/2016
私はここにいるだけで、他には何もありません。 だから私はすべてのonCreateにコードが、
prepare
ラインのまだ同じエラーを動かしました。
私は準備を削除し、
MediaPlayer mMediaPlayer = new MediaPlayer();
mMediaPlayer = MediaPlayer.create(this, R.raw.mainactivitymp3);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setLooping(true);
mMediaPlayer.start();//.release();// STOPSHIP: 6/2/2016
音が出ない。私はmainactivityを起動したときには、E/MediaPlayerの
(smethingクリックするまでmainactivityは永久にアクティブなまま)書き込み:字幕コントローラが既にリリースされずに確定
のMediaPlayerを設定しておく必要があります(私はまだ、 mainactivityを終了しませんでしたアクティブ)
.493 760-769/? V/MediaPlayer-JNI: native_finalize
.493 760-769/? V/MediaPlayer-JNI: release
.543 760-769/? V/MediaPlayer-JNI: native_finalize
.543 760-769/? V/MediaPlayer-JNI: release
.543 24067-24067/com.example W/ApplicationPackageManager: getCSCPackageItemText()
.543 760-769/? V/MediaPlayer-JNI: native_finalize
.543 760-769/? V/MediaPlayer-JNI: release
.733 24067-24067/com.example V/MediaPlayer-JNI: native_setup
.733 24067-24067/com.example V/MediaPlayer: constructor
.743 24067-24067/com.example V/MediaPlayer: setListener
.753 24067-24067/com.example V/MediaPlayer-JNI: native_setup
.753 24067-24067/com.example V/MediaPlayer: constructor
.753 24067-24067/com.example V/MediaPlayer: setListener
.753 24067-24067/com.example V/MediaPlayer-JNI: setDataSourceFD: fd 49
.753 24067-24067/com.example V/MediaPlayer: setDataSource(49, 597544, 1376079)
.763 168-556/? V/MediaPlayerService: Create new client(312) from pid 24067, uid 10177,
.763 168-430/? V/MediaPlayerService: setDataSource fd=39, offset=597544, length=1376079
.763 168-430/? V/MediaPlayerService: st_dev = 45849
.763 168-430/? V/MediaPlayerService: st_mode = 33188
.763 168-430/? V/MediaPlayerService: st_uid = 1000
.763 168-430/? V/MediaPlayerService: st_gid = 1000
.763 168-430/? V/MediaPlayerService: st_size = 3186530
.763 168-430/? V/MediaPlayerService: player type = 3
.773 168-430/? V/AudioSink: AudioOutput(1947)
.773 168-430/? V/MediaPlayerService: [312] notify (0xb7d93b78, 8, 0, 0)
.773 24067-24079/com.example V/MediaPlayer: message received msg=8, ext1=0, ext2=0
.773 24067-24079/com.example V/MediaPlayer: notify(8, 0, 0) callback on disconnected mediaplayer
.833 167-19415/? D/WVMDrmPlugIn: WVMDrmPlugin::onInitialize : 6449
.833 167-19415/? D/WVMDrmPlugIn: WVMDrmPlugin::onSetOnInfoListener : add 6449
.843 167-167/? D/WVMDrmPlugIn: WVMDrmPlugin::onTerminate : 6449
.843 168-430/? V/MediaExtractor: Autodetected media content as 'audio/mpeg' with confidence 0.20
.843 168-30639/? V/MediaPlayerService: [312] getParameter(1700)
.843 24067-24067/com.example V/MediaPlayer: setVideoSurfaceTexture
.843 168-868/? V/MediaPlayerService: [312] setVideoSurfaceTexture(0x0)
.843 24067-24067/com.example V/MediaPlayer: prepare
.843 168-168/? V/MediaPlayerService: [312] setAudioStreamType(3)
.843 168-20316/? V/MediaPlayerService: [312] prepareAsync
.873 168-24099/? V/MediaPlayerService: [312] notify (0xb7d93b78, 5, 0, 0)
.873 168-24099/? V/MediaPlayerService: [312] notify (0xb7d93b78, 1, 0, 0)
.873 24067-24078/com.example V/MediaPlayer: message received msg=5, ext1=0, ext2=0
.873 24067-24078/com.example V/MediaPlayer: New video size 0 x 0
.873 24067-24078/com.example V/MediaPlayer: callback application
.873 24067-24078/com.example V/MediaPlayer: back from callback
.873 24067-24078/com.example V/MediaPlayer: message received msg=1, ext1=0, ext2=0
.873 24067-24078/com.example V/MediaPlayer: prepared
.873 24067-24078/com.example V/MediaPlayer: signal application thread
.873 24067-24078/com.example V/MediaPlayer: callback application
.873 24067-24067/com.example V/MediaPlayer: prepare complete - status=0
.873 24067-24067/com.example V/MediaPlayer-JNI: setAudioStreamType: 3
.873 24067-24078/com.example V/MediaPlayer: back from callback
.873 24067-24067/com.example V/MediaPlayer: MediaPlayer::setAudioStreamType
.873 24067-24067/com.example V/MediaPlayer-JNI: setLooping: 1
.873 24067-24067/com.example V/MediaPlayer: MediaPlayer::setLooping
.873 168-556/? V/MediaPlayerService: [312] setLooping(1)
.873 24067-24067/com.example V/MediaPlayer-JNI: start
.873 24067-24067/com.example V/MediaPlayer: start
.873 168-430/? V/MediaPlayerService: [312] setLooping(1)
.873 168-30639/? V/MediaPlayerService: [312] setVolume(1.000000, 1.000000)
.873 168-30639/? V/AudioSink: setVolume(1.000000, 1.000000)
.873 168-30639/? V/MediaPlayerService: [312] setAuxEffectSendLevel(0.000000)
.873 168-30639/? V/AudioSink: setAuxEffectSendLevel(0.000000)
.873 168-168/? V/MediaPlayerService: [312] start
.883 168-168/? V/MediaPlayerService: [312] notify (0xb7d93b78, 6, 0, 0)
.883 24067-24079/com.example V/MediaPlayer: message received msg=6, ext1=0, ext2=0
.883 24067-24067/com.example D/Chic: MAINACTIVITY OnCreate*************
.883 24067-24079/com.example V/MediaPlayer: Received MEDIA_STARTED
.883 24067-24079/com.example V/MediaPlayer: callback application
.883 24067-24079/com.example V/MediaPlayer: back from callback
06-02 09:25:27.324 24067-24067/com.example I/MediaPlayer: Don't send intent. msg.arg1 = 0, msg.arg2 = 0
06-02 09:25:27.324 24067-24067/com.example E/MediaPlayer: Should have subtitle controller already set
06-02 09:25:27.424 24067-24067/com.example D/OpenGLRenderer: Enabling debug mode 0
06-02 09:25:27.494 24067-24067/com.example V/MediaPlayer-JNI: getCurrentPosition: 720 (msec)
06-02 09:25:27.494 24067-24067/com.example V/MediaPlayer-JNI: isPlaying: 1
06-02 09:25:27.534 24067-24146/com.example I/dalvikvm-heap: Grow heap (frag case) to 13.910MB for 3112976-byte allocation
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer-JNI: native_finalize
06-02 09:25:27.624 24067-24146/com.example D/dalvikvm: GC_FOR_ALLOC freed 3480K, 32% free 9389K/13768K, paused 25ms, total 35ms
06-02 09:25:27.624 24067-24076/com.example W/MediaPlayer-JNI: MediaPlayer finalized without being released
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer-JNI: release
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer: setListener
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer: disconnect
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer: destructor
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer: disconnect
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer-JNI: native_finalize
06-02 09:25:27.624 24067-24076/com.example W/MediaPlayer-JNI: MediaPlayer finalized without being released
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer-JNI: release
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer: setListener
06-02 09:25:27.624 24067-24076/com.example V/MediaPlayer: disconnect
06-02 09:25:27.624 168-430/? V/MediaPlayerService: disconnect(312) from pid 24067
06-02 09:25:27.644 168-430/? I/AudioPlayer: reset out
06-02 09:25:27.644 168-430/? I/SecMediaClock: SecMediaClock destructor
06-02 09:25:27.644 24067-24076/com.example V/MediaPlayer: destructor
06-02 09:25:27.644 24067-24076/com.example V/MediaPlayer: disconnect
06-02 09:25:27.644 168-30639/? V/MediaPlayerService: Client(312) destructor pid = 24067
06-02 09:25:27.644 168-30639/? V/AudioSink: +++ close
06-02 09:25:27.644 168-30639/? V/AudioSink: --- close
06-02 09:25:27.644 168-30639/? V/MediaPlayerService: disconnect(312) from pid 24067
私はすべての許可を追加しませんでした。 MY現在のもの:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Android rebuild project, package org.junit does not exist error
は、これが理由することができますか?
私は0.5秒しか聞こえませんでした。私はたくさんの回をやり直し、私はここで一人しかできませんでした。
あなたは 'MediaPlayer.create()'で作成したMediaPlayer's 'は')( '準備呼び出すことはありません。 'create()'メソッドはあなたのためにそれを処理します。 –
私の編集した質問を見てください。私も準備なしで使った。 – user6412889
prepare()を削除しないでください。mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC)を削除してください。チェック@ –