bogerchan / Nier-Visualizer

A lightweight and efficient Android visual library.
Apache License 2.0
576 stars 75 forks source link

setCaptureSize() called in wrong state: 2 #7

Closed jmimohsin closed 6 years ago

jmimohsin commented 6 years ago

Hi,

I am using your library and got more than 1k bugs from different devices in crashlytics.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{coders.hub.fm.radio/com.radios.india.RadioStationActivity}: java.lang.IllegalStateException: setCaptureSize() called in wrong state: 2
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2875)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2950)
       at android.app.ActivityThread.-wrap11(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6759)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

and second logcat:-

Caused by java.lang.IllegalStateException: setCaptureSize() called in wrong state: 2
       at android.media.audiofx.Visualizer.setCaptureSize(Visualizer.java:315)
       at me.bogerchan.niervisualizer.NierVisualizerManager.init(Unknown Source:11)
       at com.radios.india.RadioStationActivity.setVisual(Unknown Source:15)
       at com.radios.india.RadioStationActivity.onCreate(Unknown Source:340)
       at android.app.Activity.performCreate(Activity.java:6980)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2828)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2950)
       at android.app.ActivityThread.-wrap11(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6759)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

Other one...

Fatal Exception: java.lang.NoSuchMethodError: android.media.audiofx.Visualizer.setScalingMode
       at me.bogerchan.niervisualizer.NierVisualizerManager.init(Unknown Source)
       at com.radios.india.RadioStationActivity.setVisual(Unknown Source)
       at com.radios.india.RadioStationActivity.onCreate(Unknown Source)
       at android.app.Activity.performCreate(Activity.java:4470)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
       at android.app.ActivityThread.access$600(ActivityThread.java:128)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4517)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
       at dalvik.system.NativeStart.main(NativeStart.java)

Please check and let me know.

bogerchan commented 6 years ago
  1. setCaptureSize() called in wrong state: 2 is class Visualizer state error, setEnable(false) after create new Visualizer instance which can fix this bug. you can use version v0.0.3.1, code diff to see #8 .
  2. setScalingMode is added since api 16, and the Nier-Visualizer library's minSdkVersion is 19, so what is minSdkVersion in your app? If this crash is still exist in >=19 device, please give me more information (brand, os version etc..) :D
jmimohsin commented 6 years ago

I have minSdkVersion 14 in my app.

jmimohsin commented 6 years ago

image

jmimohsin commented 6 years ago

image

jmimohsin commented 6 years ago

but issue is coming mostly Android version 7 or 8 :)

jmimohsin commented 6 years ago

One more :)

Fatal Exception: java.lang.IllegalArgumentException
       at android.view.Surface.nativeUnlockCanvasAndPost(Surface.java)
       at android.view.Surface.unlockSwCanvasAndPost(Surface.java:316)
       at android.view.Surface.unlockCanvasAndPost(Surface.java:297)
       at android.view.SurfaceView$4.unlockCanvasAndPost(SurfaceView.java:1011)
       at me.bogerchan.niervisualizer.core.NierVisualizerRenderWorker.processUpdateFftEvent(Unknown Source)
       at me.bogerchan.niervisualizer.core.NierVisualizerRenderWorker.processRenderEvent(Unknown Source)
       at me.bogerchan.niervisualizer.core.NierVisualizerRenderWorker.scheduleNextRender(Unknown Source)
       at me.bogerchan.niervisualizer.core.NierVisualizerRenderWorker$mRenderHandler$2$1.handleMessage(Unknown Source)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.os.HandlerThread.run(HandlerThread.java:61)

Please check it.

bogerchan commented 6 years ago

Thanks your feedback, I have been used some apis (>14) in this library and they are necessary, please ensure user device is >= 19 when enable Visualizer. IllegalArgumentException occurs when SurfaceView has been stoped but renderer is still working, I have been fixed it in #9 , please update version to v0.0.3.3. Please feedback if there are some problem else, Thanks again. :)

jmimohsin commented 6 years ago

So all above issue fixed?

and 0.0.3.3 or 0.0.4?

Thanks for quick solution and reply.

bogerchan commented 6 years ago

Yep, 0.0.4 has been improved smoothness additionally. But JitPack has some problem now, I will update it after the server work fine. :)

jmimohsin commented 6 years ago

Thanks a lot.