获取java.lang.NoSuchMethodError:android.os.FileUtils.getFatVolumeId在4.2.2和更新版本的OS [英] Getting java.lang.NoSuchMethodError: android.os.FileUtils.getFatVolumeId in 4.2.2 and later OS

查看:381
本文介绍了获取java.lang.NoSuchMethodError:android.os.FileUtils.getFatVolumeId在4.2.2和更新版本的OS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我服务的onCreate面临的问题()试图让SD卡ID时。从SRC-外部/ Android的核心使用文件实用程序类android.os包。

I am facing issue in service onCreate() when trying to get SD Card id. Using FileUtils class of android.os package from src-external/android-core.


mCardId =
  FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());

崩溃日志:


12-31 19:55:25.804: E/AndroidRuntime(1235):
java.lang.NoSuchMethodError: android.os.FileUtils.getFatVolumeId 12-31
19:55:25.804: E/AndroidRuntime(1235):   at
cloudtv.android.cs.service.MediaPlaybackService.onCreate(MediaPlaybackService.java:198)
12-31 19:55:25.804: E/AndroidRuntime(1235):     at
android.app.ActivityThread.handleCreateService(ActivityThread.java:2572)
12-31 19:55:25.804: E/AndroidRuntime(1235):     at
android.app.ActivityThread.access$1800(ActivityThread.java:135) 12-31
19:55:25.804: E/AndroidRuntime(1235):   at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
12-31 19:55:25.804: E/AndroidRuntime(1235):     at
android.os.Handler.dispatchMessage(Handler.java:102) 12-31
19:55:25.804: E/AndroidRuntime(1235):   at
android.os.Looper.loop(Looper.java:136) 12-31 19:55:25.804:
E/AndroidRuntime(1235):     at
android.app.ActivityThread.main(ActivityThread.java:5017) 12-31
19:55:25.804: E/AndroidRuntime(1235):   at
java.lang.reflect.Method.invokeNative(Native Method) 12-31
19:55:25.804: E/AndroidRuntime(1235):   at
java.lang.reflect.Method.invoke(Method.java:515) 12-31 19:55:25.804:
E/AndroidRuntime(1235):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-31 19:55:25.804: E/AndroidRuntime(1235):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 12-31
19:55:25.804: E/AndroidRuntime(1235):   at
dalvik.system.NativeStart.main(Native Method)

在此先感谢!

Thanks in advance!

推荐答案

<一个href="https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/os/FileUtils.java"相对=nofollow> 文件实用 是一个平台的内部类,标注了 @hide 。你不应该使用它。

FileUtils is a platform-internal class, annotated with @hide. You should not be using it.

这篇关于获取java.lang.NoSuchMethodError:android.os.FileUtils.getFatVolumeId在4.2.2和更新版本的OS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆