[Interest] Qt for Android 6.8.0 & cmake - Setting package Name

Nuno Santos nuno.santos at imaginando.pt
Fri Oct 18 00:17:54 CEST 2024


Assam,

Thank you very much for your reply. It helped a lot.

Unfortunately I’m still having the same crash when launching the application and I don’t know what this means:

E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: com.imaginando.drc, PID: 2776
E AndroidRuntime: java.lang.RuntimeException: Unable to pause activity {com.imaginando.drc/org.qtproject.qt.android.bindings.QtActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.qtproject.qt.android.QtDisplayManager.unregisterDisplayListener()' on a null object reference
E AndroidRuntime: 	at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:4031)
E AndroidRuntime: 	at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3986)
E AndroidRuntime: 	at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3938)
E AndroidRuntime: 	at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:45)

Can you please enlighten me?

Thank you!

Best regards,

Nuno

> On 17 Oct 2024, at 18:59, Assam Boudjelthia <assam.boudjelthia at qt.io> wrote:
> 
> Hey,
> 
> We have some examples that use that, you could take a look at https://github.com/qt/qtdoc/blob/6.8/examples/demos/coffee/CMakeLists.txt#L72
> 
> Regards,
> Assam
> 
>> On Oct 17, 2024, at 8:45 PM, ekke <ekke at ekkes-corner.org> wrote:
>> 
>> Am 17.10.24 um 19:07 schrieb Nuno Santos:
>>> Ekke,
>>> 
>>> Thanks once again for the reply. I had the following when using the snippet you provided to me:
>>> 
>>> [cmake] CMake Error at CMakeLists.txt:48 (set_target_properties):
>>> [cmake]   set_target_properties called with incorrect number of arguments.
>>> 
>>> Any ideas?
>>> 
>> Hi Nuno,
>> 
>> please paste your set_target_properties command
>> 
>>> 
>>> 
>>> Is there any official Qt project example for more advance usage? For instance when we need to extend the activity?
>>> 
>>> In all this years, the experience I have with Qt for Android is that if I need to update Qt and I need to update and android app, I always stumble on a big mess that makes me invest a lot of time. This is not a Quick approach…
>> to be fair: Google and Apple always are changing workflows, APIs, requirements...
>>> 
>>> I don’t know if other developers share the same opinion.
>> yep - always the same. this time it was even more time to spend:port apps from 5.15 to 6.6 and then port from QMake to CMake.
>> 
>> because it's not so easy to get the needed informations I'm writing my blog pages ;-)
>> 
>> ekke
>> 
>>> 
>>> Best,
>>> 
>>> Nuno
>>> 
>>>> On 17 Oct 2024, at 17:57, ekke <ekke at ekkes-corner.org> <mailto:ekke at ekkes-corner.org> wrote:
>>>> 
>>>> Nuno,
>>>>  you also have to set the target properties
>>>> 
>>>> set_target_properties(${MY_APP}
>>>>     PROPERTIES
>>>>     QT_ANDROID_PACKAGE_SOURCE_DIR ${QT_ANDROID_PACKAGE_SOURCE_DIR}
>>>>     QT_ANDROID_MIN_SDK_VERSION ${QT_ANDROID_MIN_SDK_VERSION}
>>>>     QT_ANDROID_TARGET_SDK_VERSION ${QT_ANDROID_TARGET_SDK_VERSION}
>>>>     QT_ANDROID_PACKAGE_NAME ${QT_ANDROID_PACKAGE_NAME}
>>>>     QT_ANDROID_VERSION_NAME ${QT_ANDROID_VERSION_NAME}
>>>>     QT_ANDROID_VERSION_CODE ${QT_ANDROID_VERSION_CODE}
>>>> )
>>>> hope this helps
>>>> 
>>>> BTW: you also can take a look at https://t1p.de/ekkeCMakeAndroid
>>>> (have to tune some parts of my Qt-mobile-CMake docs, but ATM I'm still with 6.7 and QMake - waiting for a fix because of nested QML dirs coming in 6.8.1)
>>>> 
>>>> ekke
>>>> 
>>>> 
>>>> Am 17.10.24 um 18:41 schrieb Nuno Santos:
>>>>> Ekke,
>>>>> 
>>>>> Thanks for your reply. I’ve tried to set in my CMakeLists.txt:
>>>>> 
>>>>> set(QT_ANDROID_PACKAGE_NAME "com.imaginando.drc”)
>>>>> 
>>>>> And it did nothing. The problem persists. And when running the application I have:
>>>>> 
>>>>> E AndroidRuntime: FATAL EXCEPTION: main
>>>>> E AndroidRuntime: Process: org.qtproject.example.drc, PID: 13589
>>>>> E AndroidRuntime: java.lang.RuntimeException: Unable to pause activity {org.qtproject.example.drc/org.qtproject.qt.android.bindings.QtActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.qtproject.qt.android.QtDisplayManager.unregisterDisplayListener()' on a null object reference
>>>>> E AndroidRuntime: 	at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5557)
>>>>> E AndroidRuntime: 	at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5508)
>>>>> E AndroidRuntime: 	at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5460)
>>>>> 
>>>>> Also, in the bug report someone says:
>>>>> 
>>>>> Qt 6.7.2 and 6.8.0 will support for using namespace in build.gradle and using AndroidManifest.xml without <package> tag.
>>>>> The new CMake property QT_ANDROID_PACKAGE_NAME comes to 6.8.0.
>>>>> For Qt Creator 14, it will support using namespace from build.gradle and support using AndroidManifest.xml without <package> tag.
>>>>> 
>>>>> And none of this options work also. I’m using Qt 6.8.0 with Qt Creator 14.0.2
>>>>> 
>>>>> Any ideas?
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Nuno
>>>>> 
>>>>>> On 17 Oct 2024, at 17:30, ekke <ekke at ekkes-corner.org> <mailto:ekke at ekkes-corner.org> wrote:
>>>>>> 
>>>>>> In Qt 6.8 you can set QT_ANDROID_PACKAGE_NAME
>>>>>> see also: https://bugreports.qt.io/browse/QTBUG-106907
>>>>>> 
>>>>>> ekke
>>>>>> Am 17.10.24 um 17:58 schrieb Nuno Santos via Interest:
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I’m trying to port an application to Cmake in Qt for Android.
>>>>>>> 
>>>>>>> I’m not able to set the package name. I set it in QtCreator, it gets modified in AndroidManifest.xml but then, when AndroidManifest.xml is copied to the build, it has a different value and I have warning from gradle:
>>>>>>> 
>>>>>>> Value set in QtCreator: com.imaginando.drc
>>>>>>> 
>>>>>>> package="org.qtproject.example.drc" found in source AndroidManifest.xml: /private/tmp/drc/build/Android_Qt_6_8_0_Clang_arm64_v8a-Debug/android-build-drc/AndroidManifest.xml.
>>>>>>> Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported, and the value is ignored.
>>>>>>> Recommendation: remove package="org.qtproject.example.drc" from the source AndroidManifest.xml: /private/tmp/drc/build/Android_Qt_6_8_0_Clang_arm64_v8a-Debug/android-build-drc/AndroidManifest.xml.
>>>>>>> 
>>>>>>> I’ve tried to set it build.gradle as it is below without success:
>>>>>>> 
>>>>>>> android {
>>>>>>> namespace “com.imaginando.drc"
>>>>>>> 
>>>>>>> Any ideas on how to workaround this or what is the best practice?
>>>>>>> 
>>>>>>> Thanks!
>>>>>>> 
>>>>>>> Nuno
>>>>>>> 
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> Interest mailing list
>>>>>>> Interest at qt-project.org <mailto:Interest at qt-project.org>
>>>>>>> https://lists.qt-project.org/listinfo/interest
>>>>>>> 
>>>>>> _______________________________________________
>>>>>> Interest mailing list
>>>>>> Interest at qt-project.org <mailto:Interest at qt-project.org>
>>>>>> https://lists.qt-project.org/listinfo/interest
>>>> /ekkehard/
>>>> Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID: DE189929490
>>>> 
>>> 
>> 
>> _______________________________________________
>> Interest mailing list
>> 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/20241017/4cec778a/attachment.htm>


More information about the Interest mailing list