[Interest] No implementation found for boolean org.qtproject.qt5.android.QtNative.startQtAndroidPlugin

Jérôme Godbout godboutj at amotus.ca
Fri Sep 11 16:05:57 CEST 2020


There was a discussion about this a while back into Slack QtMob into the Android channel:



my android.pri now include the right manifest based on the build version:



       MANIFEST_ANDROID_AMOTUS = AndroidManifest.xml



        LIBS_ANDROID_AMOTUS = libs.xml



        versionAtLeast(QT_VERSION, 5.13.0) {

            AMOTUS_ANDROID_MANIFEST_FOLDER = "android-src/"

            AMOTUS_ANDROID_LIBS_FOLDER = "android-src/res/values/"

        }



        !versionAtLeast(QT_VERSION, 5.13.0) {

            AMOTUS_ANDROID_MANIFEST_FOLDER = "android-src/old"

            AMOTUS_ANDROID_LIBS_FOLDER = "android-src/res/values/old"

        }



        QMAKE_EXTRA_TARGETS += $$androidSourceMaker("Amotus_Android_Manifest", "/", $$AMOTUS_ROOT, $$AMOTUS_ANDROID_MANIFEST_FOLDER, MANIFEST_ANDROID_AMOTUS)

        QMAKE_EXTRA_TARGETS += $$androidSourceMaker("Amotus_Android_Libs", "res/values", $$AMOTUS_ROOT, $$AMOTUS_ANDROID_LIBS_FOLDER, LIBS_ANDROID_AMOTUS)



        DISTFILES += \

            $$AMOTUS_ANDROID_MANIFEST_FOLDER/AndroidManifest.xml \

            $$AMOTUS_ANDROID_LIBS_FOLDER/libs.xml \





The androidSourceMaker is based on Luke Vear work: https://github.com/lukevear/qmakeAndroidSourcesHelper

This allow to cherry pick part of code and happend it to the android source folder, this allow multiple subrepos contributing to the android source folder (we can only have one, which is limiting we you keep a lots of sub repos into your projects).



Here is my source for it (I did sent it to Luke Vear already, but our needs diverge, I should open source fork it, but it is right now into a private repos):



# CopyAndroidSources.pri

# MIT License

#

# Copyright (c) 2018 Luke Vear

#

# Permission is hereby granted, free of charge, to any person obtaining a copy

# of this software and associated documentation files (the "Software"), to deal

# in the Software without restriction, including without limitation the rights

# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

# copies of the Software, and to permit persons to whom the Software is

# furnished to do so, subject to the following conditions:

#

# The above copyright notice and this permission notice shall be included in all

# copies or substantial portions of the Software.

#

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

# SOFTWARE.

#

#

# Taken from https://github.com/lukevear/qmakeAndroidSourcesHelper

# commit e0e47e0d0f1b70bedcc9e31e9f8b217e027d3a54

#

# Modification is as follow

# 2018-06-01 JG remove the .gitignore section, not needed

# 2018-06-01 JG return with more export

# 2018-06-01 JG Add FORCE depends for created target



defineReplace(copyAndroidSources) {

    commandAlias = $$1

    targetDirectory = $$2

    sourceFiles = $$3



    # Ensure we were provided a valid alias for this command

    isEmpty(commandAlias) {

        error("copyAndroidSources requires a valid command alias as its first argument.")

    }



    # Ensure we were provided a valid target directory

    isEmpty(targetDirectory) {

        error("copyAndroidSources requires a valid target directory path as its second argument.")

    }



    # Ensure we were provide a valid set of source files

    isEmpty(sourceFiles) {

        error("copyAndroidSources requires a valid set of files as its third argument.")

    }



    # Make sure the command is run, TODO godboutj 2018-06-01, this should be depends on used files instead

    $${commandAlias}.depends += FORCE



    # Create the target directory

# Work around problem with Windows that cannot make or on command and syntaxt is not the same with Windows and other *nix system

contains(QMAKE_HOST.os, Windows) {

    $${commandAlias}.commands += $$escape_expand(\n\t)$(CHK_DIR_EXISTS) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/$$targetDirectory) $(MKDIR) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/$$targetDirectory)

} else {

    $${commandAlias}.commands += $$escape_expand(\n\t)$(CHK_DIR_EXISTS) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/$$targetDirectory) || $(MKDIR) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/$$targetDirectory)

}

    # Process each file that we were provided

    for(fileName, sourceFiles) {

        # Copy the file from the source directory to the target directory

        $${commandAlias}.commands += $$escape_expand(\n\t)$(COPY_FILE) $$shell_path($$fileName) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/$$targetDirectory/$$basename(fileName))

    }



    # We need to make our new command globally available so that qmake can add it to the generated Makefile

    export($${commandAlias}.commands)

    export($${commandAlias}.depends)



    # To ensure our command is run before compilation occurs we add our command to the dependency tree of 'first' (creating the tree if required)

    isEmpty(first.depends) {

        first.depends = $(first) $${commandAlias}

        export(first.depends)

       return(first $${commandAlias})

    }

    first.depends += $${commandAlias}

    export(first.depends)

    return($${commandAlias})

}



################################33

# Inside Android.pri



include(CopyAndroidSources.pri)



    defineReplace(androidPathMaker) {

        for(a, $$3) {

            result += $$1/$$2/$${a}

        }

        return($$result)

    }



    defineReplace(androidSourceMaker) {

         return($$copyAndroidSources($$1, $$2, $$androidPathMaker($$3, $$4, $$5)))

    }





-----------------------

begin discussion

----------------------------------------------


anybody have some weird injection of permission and requirements into the android manifest? seem like Qt inject 3 permission no matter if they are already present into the AndroidManifest, then the compile fail with duplicated entry?!? why is he injecting :

  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-feature android:name="android.hardware.location.gps" android:required="false" />
Is Qt 5.15 need those?  I do use the  gps location into my application, any way to prevent him for injecting those value? it corrupt the AndroidManifest.xmlAlso the

<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
doesn’t get filled, do we still need this or change the value into our AndroidManifest.xml? (edited)
1:22<https://qtmob.slack.com/archives/C204H1U11/p1591032140053500>
oh, into the GUI when editing the AndroidManifest.xml into QtCreator you get 2 checkbox to include default, I normally edit my AndroidManifest.xml into textEditor, I did not see it, it does remove the comment part :

    <!-- %%INSERT_PERMISSIONS -->
    <!-- %%INSERT_FEATURES -->
Seem like we need to remove the comments now to prevent QtCreator to inject
Screen Shot 2020-06-01 at 1.20.19 PM.png
<https://files.slack.com/files-pri/T09PZTN5A-F01500C8D6D/screen_shot_2020-06-01_at_1.20.19_pm.png>
<https://files.slack.com/files-pri/T09PZTN5A-F01500C8D6D/screen_shot_2020-06-01_at_1.20.19_pm.png>[cid:image006.png at 01D68823.23F044B0]<https://files.slack.com/files-pri/T09PZTN5A-F01500C8D6D/screen_shot_2020-06-01_at_1.20.19_pm.png>

1:25<https://qtmob.slack.com/archives/C204H1U11/p1591032312055300>
still have some question about:

<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
I guess this is useless now?! in 5.12 it resolve to:

<meta-data android:name="android.app.load_local_libs" android:value="plugins/platforms/android/libqtforandroid.so:plugins/bearer/libqandroidbearer.so:plugins/position/libqtposition_android.so:lib/libQt5QuickParticles.so"/>
same AndroidManifest.xml Source
[cid:image002.jpg at 01D6881E.EF29AA90]
Jerome Godbout<https://app.slack.com/team/U8XG6B6QL>  1:32 PM<https://qtmob.slack.com/archives/C204H1U11/p1591032763057300>
and

<meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
is not backward compatible with 5.12, do we really need 2 different AndroidManifest to support both 5.12 and 5.15 now? That’s annoying, We will need to maintain 2 version of the file or is there an easy way to merge that rules before the build (inject either depending on Qt version?
[cid:image003.png at 01D6881E.EF29AA90]
ekkescorner<https://app.slack.com/team/U4MCM14AG>  1:51 PM<https://qtmob.slack.com/archives/C204H1U11/p1591033889058300>
@Jerome Godbout<https://qtmob.slack.com/team/U8XG6B6QL> have not tried it yet but it seems we need 2 different manifest versions for 5.14/5.15 and 5.12/5.13
https://stackoverflow.com/questions/61097966/qt-on-android-runtime-error-invalid-package-identifier-when-getting-bag-for-res/62108461#62108461
and https://bugreports.qt.io/browse/QTBUG-80444 (edited)
[Stack Overflow]Stack Overflow
Qt on Android Runtime error: Invalid package identifier when getting bag for resource number 0x00000000<https://stackoverflow.com/questions/61097966/qt-on-android-runtime-error-invalid-package-identifier-when-getting-bag-for-res/62108461#62108461>
I am getting this strange error after updating my Qt version from 5.13.1 to 5.14.2 and I am not sure what is the cause of it (I also updated my gradle version from 4.1.0 to 5.5.1). The error give the
[cid:image002.jpg at 01D6881E.EF29AA90]
Jerome Godbout<https://app.slack.com/team/U8XG6B6QL>  2:31 PM<https://qtmob.slack.com/archives/C204H1U11/p1591036316059700>
seem like it. I was wondering if any XML cross platform tool to merge xml into qmake was possible?? maybe an XSLT to modify the AndroidManifest based on Qt version would be nice.
[cid:image002.jpg at 01D6881E.EF29AA90]
Jerome Godbout<https://app.slack.com/team/U8XG6B6QL>  4:39 PM<https://qtmob.slack.com/archives/C204H1U11/p1591043978060300>
seems to be working, I did a check and copy the right manifest when building depending on the Qt version. thanks





-----Original Message-----
From: Interest <interest-bounces at qt-project.org> On Behalf Of Alexander Dyagilev
Sent: September 11, 2020 8:32 AM
To: Markus Haberlander <markus.haberlander.sw at gmail.com>; ekke <ekke at ekkes-corner.org>
Cc: Qt Interest <interest at qt-project.org>
Subject: Re: [Interest] No implementation found for boolean org.qtproject.qt5.android.QtNative.startQtAndroidPlugin



Thanks. This + https://wiki.qt.io/AndroidServices helped.



On 9/11/2020 2:19 PM, Markus Haberlander wrote:

> Have a look at  https://wiki.qt.io/Qt_for_Android_known_issues :

>

> In order to work with Qt 5.14.0 and later releases, the

> AndroidManifest.xml generated for older versions has to be updated.

> This can be done either by replacing the manifest automatically using

> Qt Creator, or by manually editing the manifest. An example of the

> modifications needed can be found in

> https://codereview.qt-project.org/c/qt/qtandroidextras/+/278987

>

>

_______________________________________________

Interest mailing list

Interest at qt-project.org<mailto:Interest at qt-project.org>

https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200911/a9b9c108/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 1227 bytes
Desc: image002.jpg
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200911/a9b9c108/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 5042 bytes
Desc: image003.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200911/a9b9c108/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 198 bytes
Desc: image006.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200911/a9b9c108/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.png
Type: image/png
Size: 547 bytes
Desc: image007.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200911/a9b9c108/attachment-0005.png>


More information about the Interest mailing list