简体   繁体   English

为什么应用程序无法读取 android 资产文件?

[英]Why are android asset files not read by app?

I have a javascript file (ParameterFunctions.js) which isn't making it to the device for some reason.我有一个 javascript 文件(ParameterFunctions.js)由于某种原因没有进入设备。

It's definitely in the project:它肯定在项目中:

Android Studio 文件列表

I extracted the apk and it's definitely inside of it:我提取了apk,它肯定在里面: 提取的apk内容

When I look at the files on the device is doesn't exist:当我查看设备上的文件不存在时: webview 调试器中的文件列表

Why is this happening and how do I fix it?为什么会发生这种情况,我该如何解决? I've tried:我试过了:

  • Invalidate caches and restart使缓存无效并重新启动
  • Uninstall and reinstalled卸载并重新安装
  • Sync project with file system将项目与文件系统同步
  • Sync project with gradle files将项目与 gradle 文件同步
  • Reboot the device (both before and after reinstalling)重新启动设备(重新安装之前和之后)

I figured it out.我想到了。 There was a syntax error in the js file I was trying to include.我试图包含的 js 文件中存在语法错误。 Rather than report it Android decided that the entire file shouldn't be recognized. Android 决定不应该识别整个文件,而不是报告它。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM