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?



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… 

I don’t know if other developers share the same opinion.

Best,

Nuno

> On 17 Oct 2024, at 17:57, ekke <e...@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 <e...@ekkes-corner.org> 
>>> <mailto:e...@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@qt-project.org <mailto:Interest@qt-project.org>
>>>> https://lists.qt-project.org/listinfo/interest
>>>> 
>>> _______________________________________________
>>> Interest mailing list
>>> Interest@qt-project.org <mailto:Interest@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@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to