Android应用使用NanoHttpd搭建HTTP服务器 有更新! 2021-05-21 一、下载jar包并导入 nanohttpd2.2.0.jar 1、将jar包放在app/libs包下; 2、jar包右键选择 Add as Library... 二、使用 1、新建一个类,继承NanoHTTPD,实现构造方法,重写serve; public class HttpServer extends NanoHTTPD{ public HttpServer() throws IOException { super(9009); start(NanoHTTPD.SOCKET_READ_TIMEOUT, false); } @Override public Response serve(IHTTPSession session) { Map<String, String> parms = session.getParms(); String msg = "<html><body><h1>Hello ShanHe</h1>\n"; return newFixedLengthResponse(msg + "</body....