Android无法访问localhost(127.0.0.1)。

出现:Issue 133: localhost/127.0.0.1 not supported

原因分析:

  • Android模拟器把它自己作为了localhost!
  • 换言之:使用localhost(127.0.0.1)访问的都是模拟器自己而非本地!

解决方案:

  使用Android为本地机器定义的别名(alias):10.0.2.2 来替代localhost(127.0.0.1)即可。

更多相关文章

  1. [转]Android(安卓)SDK升级时的错误及解决方法
  2. android开发随记 - Google Map
  3. 告别Dagger2模板代码:DaggerAndroid使用详解
  4. android UI进阶之弹窗的使用(2)--实现通讯录的弹窗效果
  5. 我使用过的 控件的一些特性(layout_weight,paddingleft)
  6. 使用ProgressBar显示进度条
  7. 使用navigator.userAgent.toLowerCase()判断移动端类型
  8. Android精华汇总
  9. android 控件的使用 备注

随机推荐

  1. 中国 Android(安卓)市场进入战国时代
  2. 文字区域
  3. AdView 团队核心成员介绍 android ios应
  4. Android深入理解Context(二)Activity和Serv
  5. Android软键盘的工作原理
  6. android超简单短信接收――中级编
  7. Android使用JNI实现Java与C之间传递数据
  8. Android应用实例之---使用Linkify + 正则
  9. Android(4)—Mono For Android(安卓)第一个
  10. Android(安卓)Doze模式