Cordova app cannot load any files in assets/www (only index.html)

Randall444

I'm compiling a very simple Cordova app and deploying on Android. I want to test the smoothness of jQuery Mobile on various Android devices, so I'm compiling an app with the contents of the jQuery Mobile demo folder.

I created a new Cordova project and placed the contents of jQuery Mobile demo folder into my www folder.

I then used the Cordova binary to add the android platform, ran cordova build, and finally cordova run android.

The application opened on my phone, but no files other than the index.html will load. I connected up the app to the Chrome Inspector debugger to see what wasn't loading, here's what I saw:

Errors in debugger

All of the files that Cordova can't find, do exist in platforms/android/assets/www. Cordova can find index.html just find, but it cannot load anything else.

If I open that folder in a web browser, everything loads just fine.

Anyone know what could be causing this issue or what steps I might take to further troubleshoot and isolate the issue? I've Googled for hours and I cannot find anyone else facing a situation quite like this. For other people, it's the index.html file that won't load or they simply forgot to add the files they want into the www folder. In my case, index.html loads fine, but nothing else will (see screenshot above).

Here is my config.xml (mostly just the standard default):

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.rand.jqmdemo" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>jqmdemo</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <engine name="android" spec="~4.1.1" />
</widget>

Here is my AndroidManifest.xml file:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.elliot.jqmdemo" 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" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <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="14" android:targetSdkVersion="22" />
</manifest>

Here is my index.html file: http://pastebin.com/duFSLT5T

Randall444

I eventually figured this out. It's a Cordova issue while deploying with Android. Any folders that begin with an underscore are omitted without warning. It looks like the bug has been around for over 5 years and with no sign of getting fixed soon:

https://code.google.com/p/android/issues/detail?id=5343

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

using systemjs to load files for cordova app

From Dev

Cordova Visual Studio Plugin for Hybrid app only suppports local HTML files?

From Dev

node.js + express + socket.io cannot load javascript files into index.html

From Dev

webview cannot load index.html

From Dev

Cordova 6 app cannot load from file:// path

From Dev

Ember-cordova sample app : index.html not found

From Dev

React boilerplate doesn't load js files in the index.html

From Dev

Cordova Load Remote Site into App

From Dev

html cannot see any files when it is outside of root web directory

From Dev

html cannot see any files when it is outside of root web directory

From Dev

Installing a plugin in cordova removed All files(except index.js and index.html) from my project

From Dev

IBM Worklight - Unable to load index.html in a Dojo app

From Dev

wget to get all the files in a directory only returns index.html

From Dev

Sencha Touch App on iOS Simulator loads only index.html

From Dev

AngularJS App: How to include .js files into index.html

From Dev

Cannot load any image with CImg

From Dev

Layers with higher z-index gets ignored by touches on Windows Phone 8 Cordova HTML5 App

From Dev

Java. Is there any way to save/load whole game/app using only one java file(class...)?

From Dev

Cannot get Current Webview HTML page path when page changed from Cordova android app

From Dev

Cannot play HTML5 video in Cordova app on iOS if the video src changes

From Dev

Cordova/Phonegap YouTube iframe_api error: XMLHttpRequest cannot load chrome-extension Cross origin requests are only supported for HTTP

From Dev

HTTP load failed (kCFStreamErrorDomainSSL, -9813) in Cordova app

From Dev

External Links to load OUTSIDE of Ionic / Cordova app

From Dev

How to load cordova plugin dynamically into android app

From Dev

When redirect index.html to 404 error page, Apache doesn't load any page

From Dev

Issue in loading HTML/JS files from appdata folder of windows 8.1 Cordova app

From Dev

Cannot Load Routes in ./src/routes/index.js from ./app.js

From Dev

Karma cannot load imported files

From Dev

Karma cannot load imported files

Related Related

  1. 1

    using systemjs to load files for cordova app

  2. 2

    Cordova Visual Studio Plugin for Hybrid app only suppports local HTML files?

  3. 3

    node.js + express + socket.io cannot load javascript files into index.html

  4. 4

    webview cannot load index.html

  5. 5

    Cordova 6 app cannot load from file:// path

  6. 6

    Ember-cordova sample app : index.html not found

  7. 7

    React boilerplate doesn't load js files in the index.html

  8. 8

    Cordova Load Remote Site into App

  9. 9

    html cannot see any files when it is outside of root web directory

  10. 10

    html cannot see any files when it is outside of root web directory

  11. 11

    Installing a plugin in cordova removed All files(except index.js and index.html) from my project

  12. 12

    IBM Worklight - Unable to load index.html in a Dojo app

  13. 13

    wget to get all the files in a directory only returns index.html

  14. 14

    Sencha Touch App on iOS Simulator loads only index.html

  15. 15

    AngularJS App: How to include .js files into index.html

  16. 16

    Cannot load any image with CImg

  17. 17

    Layers with higher z-index gets ignored by touches on Windows Phone 8 Cordova HTML5 App

  18. 18

    Java. Is there any way to save/load whole game/app using only one java file(class...)?

  19. 19

    Cannot get Current Webview HTML page path when page changed from Cordova android app

  20. 20

    Cannot play HTML5 video in Cordova app on iOS if the video src changes

  21. 21

    Cordova/Phonegap YouTube iframe_api error: XMLHttpRequest cannot load chrome-extension Cross origin requests are only supported for HTTP

  22. 22

    HTTP load failed (kCFStreamErrorDomainSSL, -9813) in Cordova app

  23. 23

    External Links to load OUTSIDE of Ionic / Cordova app

  24. 24

    How to load cordova plugin dynamically into android app

  25. 25

    When redirect index.html to 404 error page, Apache doesn't load any page

  26. 26

    Issue in loading HTML/JS files from appdata folder of windows 8.1 Cordova app

  27. 27

    Cannot Load Routes in ./src/routes/index.js from ./app.js

  28. 28

    Karma cannot load imported files

  29. 29

    Karma cannot load imported files

HotTag

Archive