Unable to load ExtJS on cordova android through cordova app loader : addRow is not defined

Viewed 249

Shorter version of the story which i am trying to do : Load a Web application on cordova runtime through cordova app loader. The webapp is built on ExtJS

Process

  1. ExtJS app is getting built.
  2. bootstrap.js is getting generated for microloader concept.
  3. manifest.json is generated
  4. Cordova app is able to download and load the external web app.

When tried on android and iOS, the iOS version is working perfectly well but the android version throws several errors.

(index):1 Uncaught ReferenceError: start is not defined
    at (index):1
(index):2 Uncaught ReferenceError: onHasParentDirectory is not defined
    at (index):2
(index):3 Uncaught ReferenceError: addRow is not defined
    at (index):3
(index):4 Uncaught ReferenceError: addRow is not defined
    at (index):4
(index):5 Uncaught ReferenceError: addRow is not defined
    at (index):5
(index):6 Uncaught ReferenceError: addRow is not defined
    at (index):6
(index):7 Uncaught ReferenceError: addRow is not defined
    at (index):7
(index):8 Uncaught ReferenceError: addRow is not defined
    at (index):8

On further inspection it seems this is related to how the webview works in android and how it has problems with Hashes.

Some responses from links : - The problem is due to the link (href) with prefix “/#/xxxx” rather than “#/xxxx” … -file:///android_asset/www/main.html#" + strippedUrl; where strippedUrl means the original url with file:/// converted to just / and with potential /android_asset/www converted to an empty string, there seems to be an issue in the 4.0 Webview related to html5 routing and paths starting with /.

Reference Links :

https://gist.github.com/morganrallen/f955cc0312ae2cdbe9a5 https://forum.ionicframework.com/t/uncaught-referenceerror-addrow-is-not-defined/9266/3

To try in that approach i tried implementing the hashbang approach, but still application fails in android.

Can any one let me know how to work around these errors or what possible solution can be there.

P.S : if i work without routing in ExtJS, the application works perfectly. Errors are not in ExtJS project.

Thanks and Regards

1 Answers

I solved the issue by specifying path with index.html on it.

Earlier it was

downloadedAppUrl = fileSystem.root.nativeURL + 'app';

Now i specified

downloadedAppUrl = fileSystem.root.nativeURL + 'app/index.html';
Related