Getting java.lang.NoSuchMethodError: android.os.Fi

2019-01-26 22:16发布

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());

Crash Log :

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!

1条回答
ゆ 、 Hurt°
2楼-- · 2019-01-26 22:31

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

查看更多
登录 后发表回答