Image issue with ionic cordova run android


#1

Static Image Path I have kept in provider so I m calling provider function in my page.ts but when I run command ““ionic cordova run android”” that image wont display in my android but in web it will display and if I run the command with
"“ionic cordova run android -l -s -c”" it will display
why this difference is there and what difference not getting


#2

Show us some code.

  1. An example of how you embed an image.
  2. The provider you mentioned.

#3

hi
in my providers path-file.ts file I have given path is like below

this.logo = "../assets/icon/logo.png";

from my home-page.ts I am like below

 this.image = provider.getLogo();

and in home.html i am displaying that image

<img src = "{{image}}" >

#4

And the code of [quote=“Nikhil_dhar123, post:3, topic:94135”]
provider.getLogo();
[/quote] looks how?


#5
public getLogo() {
    return this.logo;
  }

#6

public getLogo() {
return this.logo;
}


#7

OK, so test these three and tell us if the image loads or not:

  1. ionic serve
  2. ionic cordova run android
  3. ionic cordova run android -l -s -c

#8

hi
yes I just checked last one is not loading


#9

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Chrome dev tools: https://ionic.zone/debug/remote-debug-your-app#android Look at the console and network tabs for errors.

Check if the URL it is loading is different, if the path of the files is different or anything.


#10

ohh so sorry not last one its second one and I have checked path in web also its correct and displaying also but issue is when I run with ionic cordova run android


#11

Yes, then remote debug this with the link I just posted.


#12

that link is for web and I am running in emulator :sweat:


#13

Actually I don’t know how to debug in emulator I will have to search once


#14

You are not reading what is on that page. It is not for web.


#15

hey If I am not wrong I think this is where I have to look in your above link

https://developer.android.com/studio/run/oem-usb.html

but as instructions given for windows 7 5th step is not like as in my PC there is no device name there is only PCI ports


#16

I thought relative paths for assets were frowned upon.


#17

they are working fine in web but in emulator nothing…


#18

yeah well, probably because this is not the right way to include assets. with remote debugging you will see this yourself and be able to just test different URLs.


#19

hi still not getting anything and 1 more thing is there if i use below command

ionic cordova run android -l -s -c

sqlite problem occurs it will show cordova_not_avilable command with

ionic cordova run android 

works fine but image path issue


#20

May be, but this is unrelated to the Image issue you have to solve first. Please open a new thread for the sqlite problem.