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

ekke ekke at ekkes-corner.org
Thu Oct 17 18:57:27 CEST 2024


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> 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
>>> https://lists.qt-project.org/listinfo/interest
>>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> https://lists.qt-project.org/listinfo/interest

/ekkehard/
Steuer-Nr: 156/220/30931 FA Rosenheim, UST-ID: DE189929490
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20241017/b8ce6f37/attachment.htm>


More information about the Interest mailing list