获取本地的Ip

 String ip = "";
        //获取当前设备ip
        try {
            ip = InetAddress.getLocalHost().getHostAddress();
        } catch (Exception e) {
            e.printStackTrace();
        }