Javascript 应用程序在使用document.location时终止

Javascript 应用程序在使用document.location时终止,javascript,android,html,Javascript,Android,Html,我正在使用android studio,并尝试使用JavaScript制作一个移动应用程序 我已经使用webview加载了index.html。 现在我想转到ShoppingList.html,它使用以下JavaScript代码保存在assets中 当我使用android版本6的模拟器时,它工作得非常好。但是在android版本7中,当调用Navigate()函数时,我的应用程序终止 我还尝试了window.location和document.location.href,但没有任何效果 我用来导

我正在使用android studio,并尝试使用JavaScript制作一个移动应用程序

我已经使用webview加载了
index.html

现在我想转到
ShoppingList.html
,它使用以下JavaScript代码保存在
assets

当我使用android版本6的模拟器时,它工作得非常好。但是在android版本7中,当调用
Navigate()
函数时,我的应用程序终止

我还尝试了
window.location
document.location.href
,但没有任何效果

我用来导航到另一个html文件的JavaScript代码是:

function Navigate()
{
    document.location = "file:///android_asset/www/ShoppingList.html";
}

将web资源放入“资产”文件夹中,可以调用webView.loadUrl(“file:///android_asset/filename.html)。
用于Java和Webview之间的完整通信

也许

也许问题在于从FS读取文件的权限。请检查权限,并确保文件存在。
我的应用程序终止
这些消息不会飞到这里。发布实际堆栈跟踪/错误这是我从错误日志中得到的:05-16 17:13:01.247 9294-9294/com.stephaniemartin.kitchentool E/AndroidRuntime:FATAL EXCEPTION:Process:com.stephaniemartin.kitchentool,PID:9294 android.os.FileUrieExposedException:file:///android_assets/www/ShoppingList.html 通过Intent.getData()在应用程序之外公开