I want to call my secure website, which is using a self-signed certificate, and is running on my development machine, from my emulator that is running on the same machine
I create a self-signed certificate, and installed on my development machine, and edited the hosts file to link the localhost to my domail. So: https://mydomain:8080 works perfectly on my development machine.
I installed the same certificate on my emulator, so:
https://10.0.2.2:8080 works but there emulator cannot verify the certificate because I am calling 10.0.2.2 while the certificate is issued for mydomain
The solutoin is to link the 10.0.2.2 to my mydomain
on the hosts file
The problem is that I am not able to override (edit) the hosts file on the emulator, the error message states that the file is "read-only"
It is being a long time and I am trying, I almost tried everything thing I could found, but no success, to list some:
First
adb shell su mount -o rw,remount /system chmod 777 /system
The I get the same error message
Second I run the emulator from adb command, with writable permission, but the same error happened
Third
I tried to root the emulator so I can use apps, such as Hosts Editor, but after so many trial and errors, I am not able to root the emulator
Well, I tried many, I hope you guys can give me some insights
According to the aastefanov's answer, maybe the system/
folder is still not allowed to have write access on it
I found a solution:
The solution is to modify the hosts file from the shell script, without overtiring it.
Move technical stuff
//now we are root but we cannot modify the hosts file because it is just on read-only state
mount -o rw,remount /system //to make it writable (you can be more specific and apply it to just system/etc folder)
echo "10.0.2.2 williamromadomain" >> /system/etc/hosts