1. you have to set trisa.5 to 1, make this pin as input
2. choose an ADCON1 setting that set AN4 as analog, =0 or =2 have to work
3. make sure analog comparator is disable. CMCON=7
4. use ADCIN with analog channel number, not his pin name
ADCIN 4, YourVariable

HTH