简体   繁体   English

由均衡器中的java.lang.UnsupportedOperationException引起

[英]Caused by java.lang.UnsupportedOperationException in the equalizer

I am trying to fix a bug in my app but the problem is I am not able to fix the bug as i am not able to recreate the crash but I am able to get the log and i am not able to identify what is the issue i referred the question related to UnsupportedOperationException but till now no success any guide of hint will be helpful 我正在尝试修复应用程序中的错误,但问题是我无法修复崩溃,因为我无法重新创建崩溃,但是我能够获取日志并且无法识别问题所在我提到了与UnsupportedOperationException相关的问题,但到目前为止,任何成功的提示指南都将无济于事

Log1 日志1

Fatal Exception: java.lang.RuntimeException
Unable to create service com.musicplayer.music.audioplayer.PlayerService: 
java.lang.RuntimeException: AudioEffect: set/get parameter error
android.app.ActivityThread.handleCreateService (ActivityThread.java:2801)
android.app.ActivityThread.access$1800 (ActivityThread.java:155)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1400)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:135)
android.app.ActivityThread.main (ActivityThread.java:5343)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run 
(ZygoteInit.java:905)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:700)

logcat 2 Logcat 2

    Caused by java.lang.RuntimeException
 AudioEffect: set/get parameter error
android.media.audiofx.AudioEffect.<init> (AudioEffect.java:407)
android.media.audiofx.Virtualizer.<init> (Virtualizer.java:120)
com.musicplayer.music.audioplayer.equalizermerge.model.EqualizerApi.init 
(EqualizerApi.java:23)
com.musicplayer.music.audioplayer.PlayerService.onCreate 
(PlayerService.java:400)
android.app.ActivityThread.handleCreateService (ActivityThread.java:3141)
android.app.ActivityThread.access$1800 (ActivityThread.java:178)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1640)
android.os.Handler.dispatchMessage (Handler.java:111)
android.os.Looper.loop (Looper.java:214)
android.app.ActivityThread.main (ActivityThread.java:6102)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run 
(ZygoteInit.java:1028)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:823)

As suggested i have added the complete log cat from the io.fabric EqualizerApi code 根据建议,我从io.fabric EqualizerApi代码中添加了完整的日志猫

I found a version of the source code ( https://android.googlesource.com/platform/frameworks/base/+/5bb8f80/media/java/android/media/audiofx/AudioEffect.java ), though the line numbers don't match your stacktrace. 我发现源代码的版本( https://android.googlesource.com/platform/frameworks/base/+/5bb8f80/media/java/android/media/audiofx/AudioEffect.java ),尽管行号没有与您的堆栈跟踪匹配。

It appears that an UnsupportedOperationException is thrown as a result of a problem when initializing the native code implementation of the audio effect engine. 初始化音频效果引擎的本机代码实现时,由于出现问题而抛出UnsupportedOperationException In the code I am looking at, the exception message says "Effect library not loaded". 在我正在查看的代码中,异常消息显示“未加载效果库”。 I am guessing it is caused by one of the following: 我猜这是由以下原因之一引起的:

  • A required native library is missing from the load path. 加载路径中缺少必需的本机库。 (Maybe you haven't included it in the app ...) (也许您没有将其包含在应用中...)

  • It is possible that there is a bug in the library's initialization code. 库的初始化代码中可能存在错误。


Update - The updated stacktrace and error message indicate that the problem is happening when you create the Virtualizer . 更新 -更新的堆栈跟踪和错误消息表示在创建Virtualizer时出现了问题。 The message implies that it is due to a bad parameter. 该消息暗示它是由于参数错误所致。

Looking through the code for the AudioEffect and Virtualizer classes, it appears that the Virtualizer initialzer is attempting to retrieve a parameter from the native API to test if the Virtualizer "strength" parameter is supported. 查看AudioEffect和Virtualizer类的代码,似乎Virtualizer初始化程序正在尝试从本机API检索参数以测试是否支持Virtualizer的“ strength”参数。 It appears like the API is saying that it doesn't even understand the parameter that is supposed to say whether the strength parameter is supported(!) 似乎API在说它甚至不理解应该说明强度参数是否受支持的参数(!)

The comments in the Virtualizer class near where the parameter numbers are specified say this: 在指定参数编号的位置附近的Virtualizer类中的注释说:

// These constants must be synchronized with those in 
// frameworks/base/include/media/EffectVirtualizerApi.h

Based on the behavior I deduced, it seems that is not true. 根据我推断出的行为,这似乎是不正确的。 In other words, I think ... somehow ... you are using a version of the Java API that doesn't match the version of the native API. 换句话说,我认为……某种程度上……您使用的Java API版本与本机API版本不匹配。

Alternatively, this might be happening because Virtualizer support is broken on those devices. 或者,这可能是由于这些设备上的Virtualizer支持被破坏而发生的。

I would suggest the following work-arounds: 我建议以下解决方法:

  1. Try to catch the runtime exception in your init method, and treat the Virtualizer functionality as disabled on the device. 尝试在init方法中捕获运行时异常,并将Virtualizer功能视为已在设备上禁用。

  2. If you know what the offending devices are, code your init method to not even try to configure a Virtualizer on those devices. 如果您知道有问题的设备是什么,请对init方法进行编码,甚至不要尝试在这些设备上配置虚拟器。

  3. Don't support those devices at all. 完全不支持这些设备。 (Are they old? Are they running old / poorly maintained builds of Android? Are they even worth supporting?) (它们是否旧?它们是否正在运行旧的/维护不善的Android版本?它们甚至值得支持吗?)

It is also possible that the problem is related one of these Q&As: 该问题也可能与以下问答有关:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由java.lang.UnsupportedOperationException引起:AdapterView不支持addView(View,layoutParams) - Caused by java.lang.UnsupportedOperationException: addView(View,layoutParams) is not supported in the AdapterView 原因:java.lang.UnsupportedOperationException:AdapterView不支持addView(View) - Caused by: java.lang.UnsupportedOperationException: addView(View) is not supported in AdapterView osmdroid - java.lang.UnsupportedOperationException - osmdroid - java.lang.UnsupportedOperationException 凌空java.lang.UnsupportedOperationException - Volley java.lang.UnsupportedOperationException Canvas中的java.lang.UnsupportedOperationException - java.lang.UnsupportedOperationException in Canvas 引起:java.lang.UnsupportedOperationException:无法转换为维度:type=0x12 - Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12 原因:java.lang.UnsupportedOperationException:无法转换为尺寸:type = 0x12 Android - Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12 Android java.lang.UnsupportedOperationException尝试插入片段 - java.lang.UnsupportedOperationException trying inject fragment java.lang.UnsupportedOperationException 运行时错误 - java.lang.UnsupportedOperationException Runtime Error java.lang.UnsupportedOperationException 错误 ArrayAdapter - java.lang.UnsupportedOperationException Error ArrayAdapter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM