你能帮忙去掉 android 中的文件未找到异常错误吗?

Can you help to remove the file not found exception error in android?

用于消除 android studio

中的错误的代码

根据你的照片,你用错了方法。

你应该把 assignmenttitle.docx 放在 /res/raw 不应该放在 /assets.

由于文件在您的应用程序中,因此您不应使用 "file:///android_asset/assignmenttitle.docx"。

这意味着 Android 设备存储的文件路径,而不是应用程序的资源。

相反,你应该这样使用!

Uri uri= Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + context.getPackageName() +
                    "/raw/assignmenttitle.docx");

InputStream ins = context.get().getResources().openRawResource(R.raw.assignmenttitle.docx);