Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

net::ERR_FILE_NOT_FOUND file:///android_asset/www/index.html was not found

I have a cordova app (that i'm building for Android) that I have signed using the keytools on the command line and installed this onto my Android device.

Whenever I open the app on my phone I get the following error:

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

My phone has an internet connection so there is an active mobile internet connection - can anyone help in debugging the problem?

I have come across a number of fixes that relate to moving remote assets however I cannot see in my app where I have any links to a remote URL.

Is there a way I can do a 'stack-trace' to allow me to pin-point the exact point this Application Error is being thrown within my app?

Any tips at all would be appreciated

-- update -- Here is the adb log that is generated when in the emulator

For anyone else that this may help I used the following to output the emulator log to a file:- (the double >> is needed to append data to the file)

adb -e logcat >> emulator.log

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

-- update -- My AndroidManifest.xml file looks like the following:

<?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>

-- update -- Within my platforms 'android' folder is a 'assets' folder - this has the following structure:

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

There doesn't appear to be an index.html - even though the cordova setup states an index.html file... I cannot understand why it would be doing this.

NOTE : I am creating a cordova app, adding a Android platform, then copying my existing www folder from another directory of the existing app (that has been developed and released to the Play store so works ok) - then finally doing the build. Not sure why index.html should be showing... any ideas??

like image 760
Zabs Avatar asked Sep 29 '22 07:09

Zabs


1 Answers

you should run cordova build android before cordova run android or make it simple by running cordova build android && cordova run android --device
PS: don't forget sudo if you work on mac

like image 150
ihoudjedje Avatar answered Nov 03 '22 01:11

ihoudjedje