No permission to open file on Android with Qt 5.15

  • Hi,

    I want to open a PDF file in Qt 5.15 on Android. I use


    to open the file. In Qt 5.15 this function should work on Android. (Bugfix from here: QTBUG-45585)
    Unfortunately I always get the error:

    Qt JAVA : openURL(): No permissions to open Uri

    If I test the permissions:

    qDebug() << "file: " << file;
    QFile f(file);
    qDebug() << "file exists: " << f.exists();
    f.setPermissions(QFileDevice::ReadUser | QFileDevice::WriteUser);
    qDebug() << f.permissions();

    I get the following:

    file exists:  true

    I have set android permissions for READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE in manifest.xml and also proofed the permission by:

    QtAndroid::PermissionResult r = QtAndroid::checkPermission("android.permission.READ_EXTERNAL_STORAGE");
     if(r == QtAndroid::PermissionResult::Granted) 

    If I generate a FileDialog to open the PDF there is no issue - the file opens normally.
    Does anyone have an idea or has anyone solved a similar problem?

    Thank you.

  • I opened a bug about this issue: QTBUG-85011

Log in to reply