search
HomeSystem TutorialLINUXDetailed steps and methods for modifying the hosts file in Android system

Android 系统修改 hosts 文件的详细步骤与方法

Due to some reasons, it may be necessary to change the domain name specified in the hosts file to the corresponding IP address. Android is a Linux-based system. Similar to Linux, it is set up through the hosts file.

Under Android, /etc is the linux training link to /system/etc. We need to change /system/etc/hosts to achieve this. And this file is read-only and cannot be changed directly through the shell. This can be changed by connecting to a PC using adb. The steps are as follows:

1. Obtain root permissions: adbroot

2. Set /system to be readable and writable: adbremount

3. Copy the hosts file to PC: adbpull/system/etc/hosts

4. Modify files on PC

5. Copy the files on the PC to the mobile phone: adbpush/system/etc/hosts

If you want to check whether the change is successful, you can execute adbshell on the PC and run cat/system/etc/hosts; or run cat/system/etc/hosts on the mobile phone.

In the Android 1.6 system, the hosts file format is a little different from that of PC Linux: one IP cannot correspond to multiple domain names in one line Linux hosts file modification, for example:

修改文件类型_linux hosts文件修改_修改文件软件免费下载

127.0.0.1

It is legal on most PC Linux systems, but it does not work on Android 1.6. It needs to be split into one line for each domain name to use:

127.0.0.1

127.0.0.1

127.0.0.1

------------------------------------------------- ------------------------------------------

Solution to changing hosts file and outofmemory under android

修改文件软件免费下载_修改文件类型_linux hosts文件修改

You need to use the android emulator to access a website. Although it points to the linux hosts file modification on the development machine, you need to change the hosts file on the andorid,

The website below introduces the techniques

The specific steps are as follows

1. Obtain root permissions: adbroot

2. Set /system to be readable and writable: adbremount

3. Copy the hosts file to PC: adbpull/system/etc/hosts

4. Modify files on PC

修改文件类型_修改文件软件免费下载_linux hosts文件修改

5. Copy files from PC to mobile phone: adbpush

/システム/etc/hosts

しかし、Linux仮想ホストの5番目のステップでは、メモリ不足エラーを報告する人もいます

これはパラメータを追加せずにコマンドラインから直接起動したことが原因なので、次のコマンドを使用して起動してください

$emulator–avdyouravdname–パーティションサイズ128

出身者(ブロックされている可能性があります)

================================================ === ============================================== === ===============

修改文件类型_linux hosts文件修改_修改文件软件免费下载

Androidエミュレータでhostsファイルを変更する

Android エミュレーターをダウンロードし、解凍して android-sdk-linux_x86 フォルダーを取得します

android-sdk-linux_x86/tools/

にステップインします。

./android を実行してテスト用の仮想電話を作成します

仮想電話を起動し、パーティションサイズを128Mに変更します

./emulator-avdtest-partition-size128

新しいターミナルを開き、現在のディレクトリで実行します

修改文件软件免费下载_linux hosts文件修改_修改文件类型

./adbpull/system/etc/hosts/home/jecelyin/

hostsファイルをPCに削除

後に実行

./adbrot

./アドレマウント

root権限を取得し、仮想電話上の/systemを書き込み可能として再マウントします

ラップトップ上の /home/jecelyin/hosts ファイルを変更します。ラップトップ上の Web サイトにアクセスするために仮想電話が必要な場合は、ホストの IP アドレスを 10.0.2.2 にする必要があります。

次のコマンドを実行して戻ります

./adbpush/home/jecelyin/hosts/system/etc/hosts

エミュレータを再起動します

The above is the detailed content of Detailed steps and methods for modifying the hosts file in Android system. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What is the salary of Linux administrator?What is the salary of Linux administrator?Apr 17, 2025 am 12:24 AM

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

What is the main purpose of Linux?What is the main purpose of Linux?Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Does the internet run on Linux?Does the internet run on Linux?Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

What are Linux operations?What are Linux operations?Apr 13, 2025 am 12:20 AM

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Boost Productivity with Custom Command Shortcuts Using Linux AliasesBoost Productivity with Custom Command Shortcuts Using Linux AliasesApr 12, 2025 am 11:43 AM

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

What is Linux actually good for?What is Linux actually good for?Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

Essential Tools and Frameworks for Mastering Ethical Hacking on LinuxEssential Tools and Frameworks for Mastering Ethical Hacking on LinuxApr 11, 2025 am 09:11 AM

Introduction: Securing the Digital Frontier with Linux-Based Ethical Hacking In our increasingly interconnected world, cybersecurity is paramount. Ethical hacking and penetration testing are vital for proactively identifying and mitigating vulnerabi

How to learn Linux basics?How to learn Linux basics?Apr 10, 2025 am 09:32 AM

The methods for basic Linux learning from scratch include: 1. Understand the file system and command line interface, 2. Master basic commands such as ls, cd, mkdir, 3. Learn file operations, such as creating and editing files, 4. Explore advanced usage such as pipelines and grep commands, 5. Master debugging skills and performance optimization, 6. Continuously improve skills through practice and exploration.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function