net::ERR_FILE_NOT_FOUND file:///android_asset/www/index.html 未找到

Zab*_*abs 5 android android-sdk-tools cordova

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

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

Application Error
net::ERR_FILE_NOT_FOUND (file:///android_asset/www/index.html)
Run Code Online (Sandbox Code Playgroud)

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

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

有没有一种方法可以进行“堆栈跟踪”,以便我确定在我的应用程序中抛出此应用程序错误的确切位置?

任何提示都将不胜感激

--update -- 这里是在模拟器中时生成的adb日志

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

adb -e logcat >> emulator.log
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

-- 更新 -- 在我的平台 '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
Run Code Online (Sandbox Code Playgroud)

似乎没有 index.html - 即使科尔多瓦设置声明了一个 index.html 文件......我不明白为什么会这样做。

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

小智 4

cordova build android你应该先运行cordova run android或者通过运行来简化cordova build android && cordova run android --device
PS:不要忘记sudo如果你在 mac 上工作