zoukankan      html  css  js  c++  java
  • 关于 Android 开发中的 127.0.0.1 Connection refused ...

    学习Android有一时间了!有时间就看视频,终于看到了编写代码!本人编程灵性不太够,但是还算努力,所以这节代码看两遍!现在运行没有任何问题!
    中间也出现了一些小问题,但是也都被排处了!其中,运行代码时抛出异常 127.0.0.1 Connection refused —— 127.0.0.1 地址被拒绝访问!造成不能问访本机WEB,下载mp3列表失灵!在网上查了一下这个问题 —— http://stackoverflow.com/questions/2301560/java-net-connectexception-127-0-0-18080-an-android-emulator 给出明确的答复:

      

    127.0.0.1 is a Android emulated device's own loopback interface.

    In other words, you connect to android emulated device (not to your computer) by using 127.0.0.1.

    To get connection to your machine with web-server use 10.0.2.2 or real machine IP address (if you have direct access from web).

    Use command ipconfig(Windows)/ifconfig(Linux) to obtain your IP address.

    Also see official docs or this!

              127.0.0.1 是 Android 模拟器设务自己的回送接口(既localhost)
              换言之,你不能使用电脑连接android模拟器。
              可以用android内置IP 10.0.2.2 或 用真识IP地址联接电脑。
              获取IP地址:
                        Windows 可用 ipconfig 查询IP !
                        Linux  可用 ifconfig 查询IP !

  • 相关阅读:
    第三章 Jenkins参数及web项目
    第二章 Jenkins的详细介绍
    第一章 Git+Gitlab介绍和安装
    第二章 Centos7下Airflow2.1.0安装
    第一章 Airflow基本原理
    第五章 Pinpoint-Apm常见报错
    第四章 Docker方式安装 Pinpoint
    数论练习
    CF练习
    矩阵乘法
  • 原文地址:https://www.cnblogs.com/king4220550/p/1893520.html
Copyright © 2011-2022 走看看