'android parse error parsing package

I'm developing auto update from inner server.
The download works good, but when I'm trying to install the downloaded apk I'm getting: "parse error, problem parsing package".

private BroadcastReceiver mDownloadReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
            long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0);
            Log.i(VERSION_LOG_TAG, "received download id: " + downloadId);

            DownloadManager.Query query = new DownloadManager.Query();
            query.setFilterById(enqueue);
            Cursor cursor = dm.query(query);
            if (cursor.moveToFirst()) {
                int columnIndex = cursor.getColumnIndex(DownloadManager.COLUMN_STATUS);

                if (DownloadManager.STATUS_SUCCESSFUL == cursor.getInt(columnIndex)) {
                    String uriString = cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
                    Log.i(VERSION_LOG_TAG, uriString);

                    Intent installIntent = new Intent(Intent.ACTION_VIEW);
                    File apk = new File(Uri.parse(uriString).getPath());
                    installIntent.setDataAndType(Uri.fromFile(apk), "application/vnd.android.package-archive");
                    startActivity(installIntent);
                }else{
                    Log.e(VERSION_LOG_TAG, "download failed");
                }
            }
        }
    }
};

I think it's because the url: content://downloads/my_downloads/13 What do I do wrong?



Solution 1:[1]

Just try to open the downloaded file from file manager application or you can download ex file explorer as it do not access file url directly from within app then it will not give parse error

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vikas aggarwal