Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.11.2
-
None
-
* Host: Windows 10 32 bit
* Target: Android x86 v8.1 (running on VM)
* Qt 5.11.2 Android x86 (official)
Description
I need to handle a custom "<module>-android-dependencies.xml" files. E.g. this requires at creation of a custom plugins, which should not be installed to the Qt directory (e.g. which are a sub-projects of a user project).
Currently, it is impossible to use a custom plugins which are use the JAVA/JAR files on Android, at all (which requires JNI_OnLoad and etc).
I looked on the 'androiddeployqt' sources and found out the "extraPrefixDirs" variable, which should contains a paths to the custom '<module>-android-dependencies.xml' files.
static QString absoluteFilePath(const Options *options, const QString &relativeFileName) { for (const auto &prefix : options->extraPrefixDirs) { const QString path = prefix + QLatin1Char('/') + relativeFileName; if (QFile::exists(path)) return path; } return options->qtInstallDirectory + QLatin1Char('/') + relativeFileName; }
and it is used in:
bool readAndroidDependencyXml(Options *options, const QString &moduleName, QSet<QString> *usedDependencies, QSet<QString> *remainingDependencies) { QString androidDependencyName = absoluteFilePath(options, QString::fromLatin1("/lib/%1-android-dependencies.xml").arg(moduleName)); QFile androidDependencyFile(androidDependencyName); if (androidDependencyFile.exists()) { if (options->verbose) fprintf(stdout, "Reading Android dependencies for %s\n", qPrintable(moduleName)); if (!androidDependencyFile.open(QIODevice::ReadOnly)) { fprintf(stderr, "Cannot open %s for reading.\n", qPrintable(androidDependencyName)); return false; } ... ... }
But it is impossible to use this feature, because:
1) This variable takes from the 'json' file:
{ const auto extraPrefixDirs = jsonObject.value(QLatin1String("extraPrefixDirs")).toArray(); options->extraPrefixDirs.reserve(extraPrefixDirs.size()); for (const auto &prefix : extraPrefixDirs) { options->extraPrefixDirs.push_back(prefix.toString()); } }
where the JSON file never has this variable defined, because nobody (no utility in Qt) generates this JSON 'extraPrefixDirs' variable! At least, I did not found it nor in Qt5 sources and nowhere (should it be in android_deployment_settings.prf ?)!
2) Even it has been defined, the absoluteFilePath() function will be ignore then the Qt's pre-installed paths:
static QString absoluteFilePath(const Options *options, const QString &relativeFileName) { for (const auto &prefix : options->extraPrefixDirs) { const QString path = prefix + QLatin1Char('/') + relativeFileName; if (QFile::exists(path)) return path; } return options->qtInstallDirectory + QLatin1Char('/') + relativeFileName; /// <<< THIS WILL BE ALWAYS IGNORED!! }
Seems, the absoluteFilePath() should be then renamed to absoluteFilePaths() and return a list of a paths!!
All this restrictions does not allows to use nor the 'JNI_OnLoad' functions: https://bugreports.qt.io/browse/QTBUG-71318 and makes Qt not usable at all.