- 暴力直接获取
String path = "file:///android_asset/icon_wm.png";
- 先把文件读成流,在转化地址
String path = null; InputStream abpath = getClass().getResourceAsStream("/assets/icon_wm.png"); try { path = new String(InputStreamToByte(abpath)); }catch (Exception e){ e.printStackTrace(); } private byte[] InputStreamToByte(InputStream is) throws IOException { ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); int ch; while ((ch = is.read()) != -1) { bytestream.write(ch); } byte imgdata[] = bytestream.toByteArray(); bytestream.close(); return imgdata; }