Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
None
-
5.14.2
-
None
Description
This simple program:
#include <QApplication> #include <QDialog> #include <QLabel> #include <QDir> #include <QStandardPaths> #include <QFile> #include <QTextStream> #include <QVBoxLayout> int main(int argc, char *argv[]) { QApplication a(argc, argv); QDialog dlg; dlg.setLayout( new QVBoxLayout() ); QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); if ( !QDir(path).exists() ) { if ( QDir().mkdir(path) ) dlg.layout()->addWidget( new QLabel( "Could create folder " + path, &dlg ) ); else dlg.layout()->addWidget( new QLabel( "Could NOT create folder " + path, &dlg ) ); } else { dlg.layout()->addWidget( new QLabel( "Folder exists " + path, &dlg ) ); } path += "/from_qt.txt"; QFile file(path); if (file.open(QIODevice::ReadWrite)) { QTextStream stream(&file); stream << "something" << endl; dlg.layout()->addWidget( new QLabel( "Could create file " + path, &dlg ) ); } else { dlg.layout()->addWidget( new QLabel( "Could NOT create file " + path, &dlg ) ); } dlg.show(); return a.exec(); }
Compiled using Qt 5.14.2 and Android NDK r21b with QtCreator 4.12.0 reports that file cannot be created.
The AndroidManifest.xml file cretaed through QtCreator has both android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE set.
This used to perfectly work with Qt 5.12.0 and Andoird NDK r18b.
By the way, when installing the app compiled with 5.14.2, Android reports that the app does not requests for any privileges. While when installing the one compiled with 5.12.0, it reports app needs to access external storage. So looks like android permissions and not correctly set in the apk?