java.lang.NoSuchMethodError: 在android/util/MathUtils类中没有名为dist(FFFF)F的静态方法。

4

SDK升级到28之后,滑动屏幕出现了问题

日志

W/com.xxx.xxxx: 访问隐藏方法 Landroid/util/MathUtils;->dist(FFFF)F (暗色灰名单,链接) E/ContentCatcher: 拦截器:dispatchTouchEvent-错误:java.lang.NoSuchMethodError: No static method dist(FFFF)F in class Landroid/util/MathUtils; or its super classes (declaration of 'android.util.MathUtils' appears in /system/framework/framework.jar!classes2.dex)


我在这里也遇到了同样的问题,一点头绪都没有。:( - woxingxiao
4个回答

0

我和你有同样的问题。我的测试手机是安卓9.0的小米MIX 2s。但是在安卓9.0的Pixel上我找不到这个错误。


这应该是一条注释,而不是一个答案。 - Zun

0
我和你一样也遇到了这个问题。我的测试手机是安卓 9.0 的小米 MIX 2s,但是在安卓 9.0 的 Pixel 上我并没有找到这个错误。
你可以尝试在 AndroidManifest.xml->application 中设置 android:debuggable="false"。

你的解决方案完全没有帮助。 - Zun

0

不要只是放链接。添加更多细节。 - Shashin Bhayani

0

我也遇到了同样的问题。当时我的代码是:

android:targetSdkVersion="27"

AndroidManifest.xml 中,我可以毫无问题地访问隐藏的 API,但是在更改为以下内容后:
android:targetSdkVersion="28"

不再可能了。代码构建得很好,应用程序也正常启动,当应用程序启动时我可以看到这样的日志:

Accessing hidden method Landroid/bluetooth/BluetoothHeadsetClient;->startVoiceRecognition(Landroid/bluetooth/BluetoothDevice;)Z (dark greylist, linking)

然而,当我通过按钮点击触发此方法时,应用程序崩溃并显示以下错误:

Caused by: java.lang.NoSuchMethodError: No virtual method startVoiceRecognition(Landroid/bluetooth/BluetoothDevice;)Z in class Landroid/bluetooth/BluetoothHeadsetClient; or its super classes (declaration of 'android.bluetooth.BluetoothHeadsetClient' appears in /system/framework/framework.jar)

这种行为实际上已经在这里有所记录,并且是Google做出的设计决策。有一些方法,比如将您的应用程序加入到白名单中或使用平台密钥进行签名,这将允许您使用隐藏的API。您可以在我分享的链接中了解更多相关信息。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接