几天前,我收到了我发布的应用程序的崩溃日志.
错误来自ToneGenerator,我找不到问题.
在这里,我有一个倒数计时器,当计时器达到0时,应用程序启动一个ToneGenerator.
private void lanceMinuteur(int temps,int color){ if(color == 0) minuteur.setTextColor(getResources().getColor(R.color.color_important)); else minuteur.setTextColor(getResources().getColor(R.color.color_informative)); if(chronoLance){ chrono.cancel(); } chronoLance = true; chrono = new CountDownTimer((temps + 1) * 1000,1000) { public void onTick(long millisUntilFinished) { minuteur.setText(String.valueOf(millisUntilFinished / 1000) + "\""); } public void onFinish() { minuteur.setText("0\""); minuteur.setTextColor(getResources().getColor(R.color.textcolor1design)); chronoLance = false; final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION,100); //The error is coming from here tg.startTone(ToneGenerator.TONE_PROP_ACK); } }.start(); }
我收到的崩溃日志:
java.lang.RuntimeException: Init Failed at android.media.ToneGenerator.native_setup(Native Method) at android.media.ToneGenerator.<init>(ToneGenerator.java:798) at ma.myperf.musculation.activ.GoPerformanceActivity$2.onFinish(GoPerformanceActivity.java:350) at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:118) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:150) at android.app.ActivityThread.main(ActivityThread.java:4385) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607) at dalvik.system.NativeStart.main(Native Method)
那可能是什么问题呢?如果ToneGenerator有一个尝试Catch块,我会打瞌睡但是没有.
我想也许发生崩溃的设备没有AudioManager.Stream_Notification?