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

I have asked this question on Stack Overflow but received no response, any help here would be great! Here’s my problem:


I am trying to build and run my Meteor app on Android. If I simply run

meteor run android-device

or

meteor run android-device --mobile-server http://<host>

It loads up on my device (LG-E988, Android version 4.4.2).

However, when I build the app into a .apk and run it on my device, it would not start. Here’re my steps:


I have already added the platforms, added mobile-config.js etc. Here are my last steps:

  1. Navigate into my project’s directory and run:

     $ meteor build ~/Desktop/project-build/ --server=http://<host>:<port> --verbose
    

    I get a success message.

     BUILD SUCCESSFUL
    
     Total time: 2 mins 37.466 secs
     Built the following apk(s): Android
    
  2. Navigate to ~/Desktop/project-build/android/ and I find a project/ directory, a README and a release-unsigned.apk.

    I then signed the release-unsigned.apk:

     $ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore /home/dayuloli/.keystore release-unsigned.apk <alias>
    

    Then I verified that it has been signed:

     $ jarsigner -verify -verbose -certs release-unsigned.apk
    

    And the console printed jar verified..

  3. Next I zipalign

     $ $ANDROID_HOME/build-tools/23.0.2/zipalign 4 release-unsigned.apk production.apk
    
  4. Sends the production.apk to my Android device. When I ran the app, I get an Application Error with the following message:

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

Observations

  1. The app icon shows the cordova logo instead of the logo icons I specified in the mobile-config.js

  2. When I unpacked the production.apk, I don’t see a android_asset directory. But I do see a assets/www/ directory, but this has no index.html in it.


How can I resolve this issue?

I’m not sure what could be going on here. Any error messages during build? Are you sure this is in fact the APK that has been built by Meteor? Any error messages in the Android log or Chrome debugging console for the app?

No errors until the very last step. When I meteor build it returned a success message.

I am sure it is the same .apk file

I am not sure how to check the Android log or Chrome debugging (on my device or on my computer?)

At the moment, I am using Ubuntu 14.04 to do this, I am going to try doing it on my Mac later to see if the problem persists.

I have a similar experience using meteor 1.3 rc 4, there is a index.html though in assets/www/application/ . no index.html in assets/www

Can you detail the steps you took to build and install the APK? I’ve tried to reproduce this, but it seems to work as expected for me.

@martijnwalraven , seems that the project I am currently maintained has a plugin that should be removed =]

@terenceng2010: Not sure what that fork is, but the com.meteor-cordova-update plugin should definitely not be in a Meteor 1.3 project.

I try again. Here is how I reproduce the error of Application Error - net::ERR_FILE_NOT_FOUND (file:///android_asset/www/index.html):

meteor create ohNoIsCrashing
cd ohNoIsCrashing
mkdir cordova-build-override
cd corddova-build-override
nano config.xml

use the below as the config.xml:
https://cordova.apache.org/docs/en/latest/config_ref/index.html#sample-configxml

meteor add-platform android
meteor update --release METEOR@1.3-rc.8
meteor run android-device

Try if you can reproduce it too?

You shouldn’t create your own config.xml. Meteor generates one for you at build time, and you use mobile-config.js (see docs) to adjust the defaults.