Skip to content

QtWS: Early Bird Tickets Available!

  • 0 Votes
    2 Posts
    60 Views
    jsulmJ

    @BILAL-KHAN-34 Put the mouse cursor over the yellow warning icon to see the pop-up with the information about the problem.

  • 0 Votes
    13 Posts
    374 Views
    SGaistS

    That was a nasty one. Glad you found out and thanks for sharing !

  • 0 Votes
    3 Posts
    293 Views
    D

    @gregory109 I tried:

    QtJniTypes::Context context = QNativeInterface::QAndroidApplication::context(); m_javaObject = QJniObject("org/qtproject/qt/android/purchasing/InAppPurchase", "(Landroid/content/Context;J)V", context, this);

    but it did not help. Looks like QtJniTypes::Context is not a trivial type defined with Q_DECLARE_JNI_CLASS(Context, "android/content/Context").

  • 0 Votes
    5 Posts
    1k Views
    P

    I had the same problem upgrading from 6.6 to 6.7, I resolved it by using the correct NDK (26.1.10909125), see https://doc.qt.io/qt-6/android-getting-started.html

  • 0 Votes
    2 Posts
    257 Views
    S

    @Sammasas
    I didn't find a universal way, but with an QJNIObject and objective c it works now. Java with JNiObject:

    package Klingelball; import android.content.Context; import android.content.res.Configuration; import android.util.DisplayMetrics; import android.view.WindowManager; public class AndroidSettings { public static float getFontScale(Context context) { //return getResources().getConfiguration().fontScale; Configuration configuration = context.getResources().getConfiguration(); // Get the font scale from the configuration float fontScale = configuration.fontScale; return fontScale; } }

    It's important that the file is under src/mypackage.

    .cpp file:

    #ifdef Q_OS_ANDROID QJniObject context = QNativeInterface::QAndroidApplication::context(); if(QJniObject::isClassAvailable("Klingelball/AndroidSettings")) { QJniObject androidSettingsJavaObject = QJniObject("Klingelball/AndroidSettings"); fontScale = new float(androidSettingsJavaObject.callStaticMethod<jfloat>("Klingelball/AndroidSettings", "getFontScale", "(Landroid/content/Context;)F", context.object<jobject>())); qDebug() <<"Font scale:" << *fontScale; setup_fontAndroid(*fontScale); } else { qDebug() << "JAVA CLASS UNAVAIABLE!"; fontScale = new float(1); setup_fontAndroid(*fontScale); } #endif

    iOs with objective-c:
    .mm file:

    include "iOSSettings.h" #include <UIKit/UIKit.h> int iOSSettings::getPrefferedFont() { return [UIFont preferredFontForTextStyle:UIFontTextStyleBody].pointSize; }

    .h file:

    class iOSSettings { public: static int getPrefferedFont(); };

    .cpp file:

    #ifdef Q_OS_IOS fontScale = new float(getfontScalefrompointSize(iOSSettings::getPrefferedFont())); setup_fontiOS(iOSSettings::getPrefferedFont()); #endif

    iOS returns the preffered Fontsize, I implemented a function that returns a factor based on the fontsize because I had to scale the Icons too.
    Hope this helps somebody :)

  • 1 Votes
    1 Posts
    242 Views
    No one has replied
  • 0 Votes
    4 Posts
    362 Views
    JoeCFDJ

    @chenPeng First, you need to click Download OpenSSL Button to install android_openssl.

  • 0 Votes
    9 Posts
    2k Views
    B

    I had the same problem and solved it on Ubuntu by deleting the cache of QtCreator using :

    rm -R ~/.cache/QtProject
  • 2 Votes
    8 Posts
    550 Views
    ekkescornerE

    @SGaist did some more tests. removed some lines with errors from .pro and got some more output from qmake2cmake. but only for the easy parts ;-)

    android or ios - specific parts are missed.
    ATM I'm learning from CMakeLists.txt provided by Qt example apps, other projects and documentation.

    what's really missed: official guides for mobile (android and ios) apps (including translations, native code, custom info.plist, Android Manifest, openSSL) from build to deploy and publish to stores using CMake.

    of course I'll blog about my findings in some weeks.

  • 1 Votes
    6 Posts
    2k Views
    JoeCFDJ

    @TheoSys File a bug to Qt and tell them to fix it.

  • 0 Votes
    2 Posts
    642 Views
    BondrusiekB

    @Bondrusiek
    I solved that. Do this steps:

    Select the "Projects" tab on the left. In the left side panel, select the "Build Android APK" section. Scroll down to the "Build Steps" section and find the "Packaging" step. In the "Packaging" section, you should see a "Sign package" checkbox. Make sure it's checked. Configure "Signing Configuration" with required information such as keystore file path, keystore password, key alias and key password. If you don't already have a keystore file, you can create one using the java keytool. Click the "Apply" button to save your changes. Now try building your Android APK again by clicking on the green arrow icon (or using Ctrl + B) in the lower left corner of Qt Creator.
  • 0 Votes
    3 Posts
    708 Views
    SeDiS

    @JoeCFD Thank you for your answer, but that was exactly what I had done - tried and tried all over again. The solution came now with vigorously erasing all of AndroidSDK, upgrading Creator. Now it works!! I'll probably never know why it didn't before. :-)

  • 2 Votes
    3 Posts
    487 Views
    A

    UPDATE: This is a known bug in Qt https://bugreports.qt.io/browse/QTBUG-113616

  • 0 Votes
    2 Posts
    336 Views
    TomZT

    I always sign all packages I deploy on the device, regardless of it being a debug or release one.

    Why would debug vs release make any difference in whether it should be signed or not?

  • 0 Votes
    8 Posts
    1k Views
    R

    @Recursion

    I really think I identified the actual issue now so I need help essentially getting my Xamarin service added/linked to the Qt project. I am unsure how to do this.

    I followed the tutorial here and I have tried both starting up the function in the service and binding to it and neither work.

    QT6 Android Services

    I am pretty convinced that the problem is that in the example they created a class QtAndroidService that extends QtService. In my case I just extended Service as QtService isn't available in Xamarin/C#. The example says this should work.

    Here is the thing though. In the example it executes the function for example bycalling the method startQtAndroidService located at "org/qtproject/example/qtandroidservice/QtAndroidService".

    I looked at my current Qt project and its directory starts off the exact same "org.qtproject.example.myappname". I guess I must have just built the UI off an example and never changed it.

    So I think this means that somehow they put the library file QtAndroidService within the Qt project.

    I'm assuming its a .so file because when I currently run it I'll get back an error saying "Didn't find class "SOB.Bacon.com.backend.RunBackend.ForegroundBackendService" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib, /system/vendor/lib]]". The class is still named ForegroundBackendService but its not a foreground service anymore I followed the example exactly just kept the same name I'll change it.

    If I look in the /system/lib folder on the Android device it is filled with files with lib in the name ending in .so.

    If I look in my SOB.Bacon project install directory on the Android device there is a lib folder. I do not see a library with the same name as my service though, the .so files that are in there seem to have nothing to do with anything other than what Xamarin needs.

    So first off I do not know how to get Xamarin to generate a .so file. It will make a .dll file but that is for use by other Xamarin applications.

    So I have two routes/questions:

    1. Based on that example how do I link/point Qt to look for the service in a different location on the Android tablet, right now it seems to only be looking in /system/lib or /system/vendor/lib.

    2. If a .so file is required, how was the other xamarin application able to execute the service, and how was ADB able to execute the service? In which case how do I make Qt execute a service that is NOT part of its own package?

    Thanks a lot!

  • 1 Votes
    1 Posts
    226 Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    V

    @TheoSys said in Qt6.5.0: Android: Can't create main activity:

    Qt5.15 app for Android to Qt6.5.0

    Exactly the same problem after moving app from Qt5.15 Qt6.5

  • 0 Votes
    1 Posts
    161 Views
    No one has replied
  • 0 Votes
    3 Posts
    370 Views
    A

    @JoeCFD
    thank you so much for your reply. you save me from this problem.
    i solve this by removing other mingW compiler and it work properly.

  • 0 Votes
    4 Posts
    456 Views
    A

    I figure out this is because of Q_Object macro I added in those files.
    I don't know why the macro doesn't work maybe better open another post.
    in other posts people suggest to rerun the qmke to solve this problem but doesn't work for me
    anyone know why Q_Object macro doesn't work for android?