net::ERR_FILE_NOT_FOUND 文件:///android_asset/www/index.html 未找到
net::ERR_FILE_NOT_FOUND file:///android_asset/www/index.html was not found
我有一个 cordova 应用程序(我正在为 Android 构建),我已经在命令行上使用 keytools 签名并将其安装到我的 Android 设备上。
每当我在 phone 上打开应用程序时,我都会收到以下错误消息:
Application Error
net::ERR_FILE_NOT_FOUND (file:///android_asset/www/index.html)
我的 phone 有互联网连接,因此移动互联网连接有效 - 谁能帮助调试问题?
我遇到了一些与移动远程资产相关的修复,但是我在我的应用程序中看不到任何指向远程资产的链接 URL。
有没有什么方法可以让我做一个 'stack-trace' 来确定我的应用程序中抛出这个应用程序错误的确切位置?
如有任何 提示,我们将不胜感激
-- 更新 --
这是在模拟器中生成的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 命令来修复这个错误:
ionic cordova platform add android
ionic cordova run android
我有一个 cordova 应用程序(我正在为 Android 构建),我已经在命令行上使用 keytools 签名并将其安装到我的 Android 设备上。
每当我在 phone 上打开应用程序时,我都会收到以下错误消息:
Application Error
net::ERR_FILE_NOT_FOUND (file:///android_asset/www/index.html)
我的 phone 有互联网连接,因此移动互联网连接有效 - 谁能帮助调试问题?
我遇到了一些与移动远程资产相关的修复,但是我在我的应用程序中看不到任何指向远程资产的链接 URL。
有没有什么方法可以让我做一个 'stack-trace' 来确定我的应用程序中抛出这个应用程序错误的确切位置?
如有任何 提示,我们将不胜感激
-- 更新 -- 这是在模拟器中生成的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 命令来修复这个错误:
ionic cordova platform add android
ionic cordova run android