Android 5.0中的解析错误,适用于以前的版本

时间:2015-01-13 12:45:43

标签: android

我有一个apk从网站下载。它在Android 4中运行良好,但是当我使用Android 5.0设备下载它时,我得到了典型的错误:

解析错误 解析包

时出现问题

任何人都可以对正在发生的事情有所了解吗?

我的服务器代码获取apk文件(我不想直接将apk文件放在网站上下载):

InputStream is = ApkDownloadController.class.getResourceAsStream("/apk/fileName.apk");
        try {

        response.addHeader("Content-Description", "File Transfer");
        response.addHeader("Content-Type", " application/vnd.android.package-archive");
        response.addHeader("Content-Disposition", "attachment; filename=apkName.apk");
        response.addHeader("Content-Transfer-Encoding", "binary");

        ServletOutputStream out = response.getOutputStream();
        byte[] outputByte = new byte[4096];
        // copy binary contect to output stream
        while (is.read(outputByte, 0, 4096) != -1) {
            out.write(outputByte, 0, 4096);
        }
        is.close();
        out.flush();
        out.close();

全部谢谢!

0 个答案:

没有答案