Halo All,
I'm developing a mobile website and I want to see how it looks in Android Simulator.
I manage to edit my android's /etc/hosts file. Here's what I did:
1. Create an Android Virtual Device (AVD)
2. Open the AVD with this command
Code:
./emulator -avd android -partition-size 128
3. Execute the following commands
Code:
./adb remount
4. Get the android hosts file
Code:
./adb pull /etc/hosts
5. Add my mobile website into the android's hosts file. It looks like the following
Code:
127.0.0.1 localhost
172.19.14.46 m.myweb.localhost
6. Push the hosts file to the simulator
Code:
./adb push hosts /etc/hosts
7. Open the web mobile in the simulator and Host do not found. The web mobile should appear.
Did I miss something here?
Btw I use Ubuntu 10.10 and android-sdk_r08-linux_86 API 7 (Android SDK 2.1)
It's been 2 days and no reply. I wonder whether the question is confusing to understand or it cannot be replicated.
FYI, m.myweb.localhost is a virtual host running in my local machine.
found a solution for this problem?
spending the whole ****ing day with it -.-
yes, you can change name it?
I have used adfree for a long time and never had any issues until the TB. For some reason the ads are still all over the place. I have updated host files and all I know to do... any suggestions?
i'm assuming that you're rooted, right? i'd verify that your hosts file in /etc has entries other than for the local host.
alternatively, you could try using dolphin hd with the ad-blocker add-on.
open the /system/etc/hosts file on your android phone via the command line or with a file explorer (must be rooted and have write permissions for /etc/system/hosts)
add the ad server list from http://pgl.yoyo.org/adservers/ to the file
(if you change the IPs to 0.0.0.0 instead of 127.0.0.1, the ads will be killed faster, since they wont die in the loopback with 127.0.0.1, since 0.0.0.0 is an invalid address)
If you find ad server lists from elsewhere, add it to the file and filter out extras doing a unique sort on it. I normally keep the same list on my desktop/laptop and phone and add to it as I go using something like live http headers in firefox to find new ad servers
On a linux box you can do a unique sort with:
sort -u oldFileName > newFileName
Here is my list of adservers I block from found lists and ones I added myself.
http://pastebin.com/pF1QNEm2
Hi,
i edited /system/etc/hosts file but it looks that my edit is ignored by Android.
In "hosts" file i added line with text "1.1.1.1 customdomain"
And then i used "ping customdomain" command in Terminal Emulator but i got error "unknown host am".
I doesn't ignore the hosts file, did you edit it with r/w permissions?
That's how some AdBlock apps on market are working.
They just download huge (700K) host file and most of ads are history. (also in ads based applications)
PS: try something with your local host 127.0.0.1 first... you have to reboot your device after modification.
evilkorn said:
I doesn't ignore the hosts file, did you edit it with r/w permissions?
Click to expand...
Click to collapse
AFAIK, i did. I edited it using "FS File Explorer" with r/w turned on... Then i restarted phone and my change is still there.
Vlad_z said:
That's how some AdBlock apps on market are working.
They just download huge (700K) host file and most of ads are history. (also in ads based applications)
PS: try something with your local host 127.0.0.1 first... you have to reboot your device after modification.
Click to expand...
Click to collapse
Yes, i found posts about these ad blocks when i read all these forums about this...
I can ping "localhost", but i cant ping this host i added there...
EDIT:
I added record "127.0.0.1 bbb", then i restarted phone and i tried to run "ping bbb", but i got error msg about unresolved hostname aswell...
I have Nexus S and latest CyanogenMod 7.0.3 if it can help...
I got it!
I was playing etc... And i found that i need to put 1 empty line at end of file to make system to reload file!
No need to restart phone at all, i can ping new hostname immediatelly.
Now i can ping new hostname. But when i open it in Android browser, i get new exciting error msg:
Sorry The requested server does not have a DNS entry!
Any ideas now?
mathdotrandom: Block ads on PC & Android with an uber HOSTS file!
oktam said:
AFAIK, i did. I edited it using "FS File Explorer" with r/w turned on... Then i restarted phone and my change is still there.
Yes, i found posts about these ad blocks when i read all these forums about this...
I can ping "localhost", but i cant ping this host i added there...
EDIT:
I added record "127.0.0.1 bbb", then i restarted phone and i tried to run "ping bbb", but i got error msg about unresolved hostname aswell...
I have Nexus S and latest CyanogenMod 7.0.3 if it can help...
Click to expand...
Click to collapse
This approach and file "Block ads on PC & Android with an uber HOSTS file!" has work flawlessly on multiple device all with various firmwares and versions of Android.
Hi, I've included some domains I want blocked in my hosts file so as to redirect them to "127.0.0.1" I've made sure the permissions are set correctly. I've made sure there is an extra linebreak at the end of the file. I've rebooted. In the terminal a PING request to the domain returns from the localhost. And yet I can still access the domain through the web browser.
What gives?
PS: I have a Nexus One 2.3.6 retail that I rooted using the DoomLord zerg rush exploit without unlocking the bootloader
And I have cleared the browser cache
Please use the Q&A Forum for questions Thanks
Moving to Q&A
have the same issue.
added an entry to etc/hosts (after remounting rw) rebooted. open a terminal... ping x.com goes to correct IP... browser (stock and others) goes to real dns resolved one.
android is full of brain [email protected]%
I can still access websites listed in the hosts file. Permission is -rw-r--r--
I'm using chrome beta for android.
This issue hasn't been fixed yet. Chrome still ignores the HOSTS file in \system\etc
Apparently the HOSTS file must be in UNIX file format. One way to do this is use Notepad++ and convert the file by going to EDIT --> EOL Conversion --> Unix.
If you ping a domain in the hosts file and it goes to 127.0.0.1 or 0.0.0.0 then your hosts file is formatted correctly.
But Chrome will ignore the domains in the hosts even if it's formatted correctly. Perhaps Google intentionally does this to prevent anyone from blocking their tracking tools?
I would bet there are millions of Android devices that have a hosts file but it's not working as everyone thinks it should be.
EDIT - Solution found: turn off "Reduce data usage" in Chrome
shizat63 said:
turn off "Reduce data usage" in Chrome
Click to expand...
Click to collapse
Wow. Any idea what does it trigger that affect that?
My problem is with stock browser on cyanogenmod gingerbread.
Sent from my Nexus One using xda app-developers app
chrome local domain fail
shizat63 said:
EDIT - Solution found: turn off "Reduce data usage" in Chrome
Click to expand...
Click to collapse
Unfortunately it does not work for me on my GT-I9305 (I9305XXUEML5).
For the record here is what I did:
Added domain.local to /system/etc/hosts:
Code:
[email protected]:/ # mount -o rw,remount -t ext4 /dev/block/mmcblk0p13 /system
[email protected]:/ # echo "127.0.0.1 domain.local" >> /system/etc/hosts
[email protected]:/ # mount -o ro,remount -t ext4 /dev/block/mmcblk0p13 /system
[email protected]:/ # grep domain.local /system/etc/hosts
127.0.0.1 domain.local
I can now ping domain.local:
Code:
[email protected]:/ # ping domain.local
PING domain.local (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.220 ms
64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.186 ms
64 bytes from 127.0.0.1: seq=2 ttl=64 time=0.242 ms
^C
--- domain.local ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.186/0.216/0.242 ms
Then I set up port forwarding in chrome: chrome://inspect/#devices -> Port forwarding... -> 8080 x.x.x.x:8080
After this I can telnet into domain.local from my GT-I9305:
Code:
[email protected]:/ # telnet domain.local 8080
GET / HTTP/1.0
HTTP/1.0 200 OK
Date: Mon, 28 Apr 2014 11:47:42 GMT
Server: openresty
X-Powered-By: PHP/5.4.12
Connection: close
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html>
<html>
...
</html>
Connection closed by foreign host
So far so good.
Unfortunately if I open chrome on my mobile and enter domain.local:8080/ I get "Oops! Google Chrome could not connect to domain.local"
shizat63 said:
EDIT - Solution found: turn off "Reduce data usage" in Chrome
Click to expand...
Click to collapse
Worked! Thanks a lot. The fact, that adaware has stopped working was driving me crazy.
Howgie
shizat63 said:
turn off "Reduce data usage" in Chrome
Click to expand...
Click to collapse
It was turned on and turbo-mode in Opera was turned on. I've been sure hosts file is ignored!
The extra line was what I needed to fix my problem with my hosts file. As soon as I saved and refreshed it went to the site I needed it to.
oktam said:
I got it!
I was playing etc... And i found that i need to put 1 empty line at end of file to make system to reload file!
No need to restart phone at all, i can ping new hostname immediatelly.
Now i can ping new hostname. But when i open it in Android browser, i get new exciting error msg:
Sorry The requested server does not have a DNS entry!
Any ideas now?
Click to expand...
Click to collapse
Hosts file is working when i use directly from chrome and default browser, but when i use google app and then it is showing to choose chrome or internet browser it is not blocking site in hosts file after my chrome selection.
Plz.....i need help....
Was anyone able to get Android to read your hosts file? I can't even ping the site properly using the terminal emulator.
I've turned off Chrome data saver, made sure the file was saved with Unix line endings and left a blank line at the end of the /system/etc/hosts file.
I did. I copied the hosts file to my computer, edited it then pushed it back to android with rw permission.
It didn't work though until I added the blank line below my last entry (why?), just hit enter after adding your last/only domain name entry and then save.
How to change r/w permissions with Es file explorer.
Hi guys.. exist a application for redirect all hosts on my lan on my android device (192.168.1.x) ???
I have installed a webserver on Android. Thank u
If 19.168.1.2 go to www.*.it... 192.168.1.2 > redirect to my android device...
If 19.168.1.3 go to www.*.com... 192.168.1.3 > redirect to my android device...
etc
Hi,
is there someone that have experience with rooting a Smart TV from LG with WebOS.
I need to do that for mij project.
I need to make an full physical image of the memory.
Thx,
Rene
Starting Nmap 6.40 ( http://nmap.org ) at 2017-01-28 09:43 PST
Nmap scan report for LGSmartTV (192.168.1.xyz)
Host is up (0.0011s latency).
Not shown: 65525 closed ports
PORT STATE SERVICE
1029/tcp open ms-lsa
1726/tcp open unknown
1900/tcp open upnp
2005/tcp open deslogin
3000/tcp open ppp
3001/tcp open nessus
9955/tcp open unknown
9998/tcp open distinct32
18181/tcp open opsec-cvp
36866/tcp open unknown
MAC Address: DE:EZ:NU:TZ (Unknown)
Nmap done: 1 IP address (1 host up) scanned in 4.73 seconds