Ionic run android failed to load resource (android_asset/assets) ionic 2

Hello, i need help!
When i call to ionic serve, all it works. But if i call to ionic run android, the console shows Failed to load resource: net::ERR_FILE_NOT_FOUND file:///android_asset/assets/i18n/string-es.json

I don’t know why … Somebody can help me please?? Thanks all.

Ionic version: 2.1.1
cordova version: 6.3.1
npm version: 3.8.6

2 Likes

Got some. Seems like problem with relative links. Got the same with i18n. Any update on this? Can lead dev give feedback on this? All builds are failing due to this regarding localisation.

I think that the relatives links are good because the ionic serve command works. Maybe npm-scripts? Cordova? I do not know :frowning:

I have discovered that when modify my lang file .json, the bundle update don’t start. Besides, don’t copy the file to ‘www’ folder. Mybe that problem is related to my issue… Do you know why? Thank you so much.

@CSantos8 I don’t know where you are using that path, in my case I’m using i18n loading from ./assets/i18n and it works fine (I load with the ng2-translate TranslateLoader), but I had a similar problem with css images where I used the url path /assets/img and it worked with ionic serve, but in android it tried to load from file:///android_asset/assets/img and showed an ERR_FILE_NOT_FOUND error.

So, instead, I used the relative path ../assets/img and it worked both for ionic serve and when running in device. Maybe you could give it a try (using a path like ../assets/i18n or something like this).

1 Like

Thank you @lucasbasquerotto I have updated ng2-translate to last version and i think that this works. However, i have the same problems of you with the imgs. I’ll try to fix it…

1 Like

Exactly what happened in my case. It was driving me crazy as the css background image loaded in serve but was not showing in device when i loaded it using “assets/img…”

changed it to “…/assets/img…” and it worked fine in device and also serve.

In case it’s helpful to anyone. I tried the following:

/assets/fileName
…/assets/fileName
./assets/fileName
assets/fileName

The one that worked for me was ./

1 Like