net::ERR_FILE_NOT_FOUND file:///android_asset/www/index.html



我有一个cordova应用程序(我正在为Android构建),我已经使用命令行上的密钥工具对其进行了签名,并将其安装到我的Android设备上。

每当我在手机上打开应用程序时,我都会收到以下错误:

Application Error
net::ERR_FILE_NOT_FOUND (file:///android_asset/www/index.html)

我的手机有互联网连接,所以有一个活动的移动互联网连接-有人能帮助调试问题吗?

我遇到了许多与移动远程资产有关的修复程序,但我在应用程序中看不到有任何远程URL链接的地方。

有没有一种方法可以让我做一个"堆栈跟踪",让我确定这个应用程序错误在我的应用程序中抛出的确切点?

任何提示都将受到的赞赏

--更新--这是在模拟器中生成的adb日志

对于其他可能对此有所帮助的人,我使用以下方法将模拟器日志输出到文件中:-(需要双击>>将数据附加到文件中)

adb -e logcat >> emulator.log

https://gist.github.com/anonymous/e53abb7eb089950ac4e5

--更新--我的AndroidManifest.xml文件如下所示:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.myapp" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" />
</manifest>

--更新--在我的平台中,"android"文件夹是一个"assets"文件夹,其结构如下:

www/
_where-is-www.txt
www/css
www/img
www/js
www/res
www/app.html
www/cordova.js
www/cordova_plugins.js
www/index.php

似乎没有index.html-即使cordova设置声明了一个index.html文件。。。我不明白它为什么要这么做。

注意:我正在创建一个cordova应用程序,添加一个Android平台,然后从现有应用程序的另一个目录中复制我现有的www文件夹(该应用程序已经开发并发布到Play商店,所以工作正常),最后进行构建。不确定为什么要显示index.html。。。有什么想法吗??

您应该在cordova run android之前运行cordova build android,或者通过运行cordova build android && cordova run android --device
PS:如果您在mac 上工作,请不要忘记sudo

我不得不运行离子命令来修复这个错误:

ionic cordova platform add android
ionic cordova run android

https://forum.ionicframework.com/t/ionic-err-file-not-found-file-android-asset-www-index-html/91629/2

最新更新