Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Android manifest variable

Android manifest variable

Scheduled Pinned Locked Moved Solved Installation and Deployment
5 Posts 4 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SeDiS Offline
    SeDiS Offline
    SeDi
    wrote on last edited by SeDi
    #1

    Hi,
    according to this post, which says:

    -- %%INSERT_APP_NAME%% -- correspond to qmake setting TARGET
    

    And the documentation here, which states:

    TARGET
    Specifies the name of the target file. Contains the base name of the project file by default.
    For example:
    [...]
    TARGET = myapp
    [...]
    The project file above would produce an executable named myapp on unix and myapp.exe on Windows.
    

    I have added the following in my .pro file:

    TARGET = MahlZahl
    

    When I use this, the application is being built and deployed to Android, but will stop with the error message

    Your application encountered a fatal error and cannot continue
    

    before any possibility to debug it. Using small letters only for the app name or changing "=" to "+=" doesn't change a thing.
    Building and running the same project in Windows works well.

    My application output shows (please note, that I am not using "containsKey" in my code!):

    W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Bundle.containsKey(java.lang.String)' on a null object reference
    W System.err: 	at org.qtproject.qt5.android.QtNative$4.run(QtNative.java:495)
    W System.err: 	at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87)
    W System.err: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
    W System.err: 	at java.lang.Thread.run(Thread.java:764)
    W System.err: java.lang.Exception:
    W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.loadApplication(QtLoader.java:268)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:505)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:166)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreateHook(QtActivity.java:267)
    W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:274)
    W System.err: 	at android.app.Activity.performCreate(Activity.java:7136)
    W System.err: 	at android.app.Activity.performCreate(Activity.java:7127)
    W System.err: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
    W System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
    W System.err: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3063)
    W System.err: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    W System.err: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    W System.err: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    W System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
    W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:107)
    W System.err: 	at android.os.Looper.loop(Looper.java:198)
    W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6729)
    W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
    W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
    

    Developing on a Win10 machine with Qt 5.15.2 with Qt Creator 4.14.1., targeting a Nokia 8 with Android-Version 9

    P.S.: This is a redefinition of an unanswered question from some 15hs before, that I've just deleted. As I have new information I didn't want the other thread to be unnecessarily cluttered.

    KroMignonK 1 Reply Last reply
    0
    • SeDiS SeDi

      Hi,
      according to this post, which says:

      -- %%INSERT_APP_NAME%% -- correspond to qmake setting TARGET
      

      And the documentation here, which states:

      TARGET
      Specifies the name of the target file. Contains the base name of the project file by default.
      For example:
      [...]
      TARGET = myapp
      [...]
      The project file above would produce an executable named myapp on unix and myapp.exe on Windows.
      

      I have added the following in my .pro file:

      TARGET = MahlZahl
      

      When I use this, the application is being built and deployed to Android, but will stop with the error message

      Your application encountered a fatal error and cannot continue
      

      before any possibility to debug it. Using small letters only for the app name or changing "=" to "+=" doesn't change a thing.
      Building and running the same project in Windows works well.

      My application output shows (please note, that I am not using "containsKey" in my code!):

      W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Bundle.containsKey(java.lang.String)' on a null object reference
      W System.err: 	at org.qtproject.qt5.android.QtNative$4.run(QtNative.java:495)
      W System.err: 	at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87)
      W System.err: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
      W System.err: 	at java.lang.Thread.run(Thread.java:764)
      W System.err: java.lang.Exception:
      W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.loadApplication(QtLoader.java:268)
      W System.err: 	at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:505)
      W System.err: 	at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:166)
      W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreateHook(QtActivity.java:267)
      W System.err: 	at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:274)
      W System.err: 	at android.app.Activity.performCreate(Activity.java:7136)
      W System.err: 	at android.app.Activity.performCreate(Activity.java:7127)
      W System.err: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
      W System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
      W System.err: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3063)
      W System.err: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
      W System.err: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
      W System.err: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
      W System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
      W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:107)
      W System.err: 	at android.os.Looper.loop(Looper.java:198)
      W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6729)
      W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
      W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
      W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
      

      Developing on a Win10 machine with Qt 5.15.2 with Qt Creator 4.14.1., targeting a Nokia 8 with Android-Version 9

      P.S.: This is a redefinition of an unanswered question from some 15hs before, that I've just deleted. As I have new information I didn't want the other thread to be unnecessarily cluttered.

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by
      #2

      @SeDi said in Android manifest variable:

      -- %%INSERT_APP_NAME%% -- correspond to qmake setting TARGET

      Do you use -- %%INSERT_APP_NAME%% -- in you AndroidManifest?

      Can you show where?

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      1
      • SeDiS Offline
        SeDiS Offline
        SeDi
        wrote on last edited by SeDi
        #3

        @KroMignon said in Android manifest variable:

        Do you use -- %%INSERT_APP_NAME%% -- in you AndroidManifest?
        Can you show where?

        Thanks for your answer, @KroMignon! Of course I can:

        <?xml version="1.0"?>
        <manifest package="de.myurl.myapp" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto">
            <!-- %%INSERT_PERMISSIONS -->
            <!-- %%INSERT_FEATURES -->
            <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
            <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true" android:icon="@drawable/icon">
                <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="userLandscape" android:launchMode="singleTop">
        
        [...other stuff...]
        
                </activity>
                  </application>
                      <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="24"/>
        </manifest>  
        

        It's in there twice, once in the <aplication... tag and once in the <activity... tag.
        Both times as

        android:label="-- %%INSERT_APP_NAME%% --"
        

        My .pro successfully defines version code and version name this way:

        ANDROID_VERSION_CODE = "0"
        ANDROID_VERSION_NAME = "0.0.1"
        
        1 Reply Last reply
        0
        • J.HilkJ Online
          J.HilkJ Online
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          So I run into that just recently.

          After 2 days of debugging and trying I found the error.

          For me it was white spaces My App Project.pro in the project file. Once I changed that to MyAppProject.pro the error went away.

          Strange that it used to work with whitespaces just fine. In fact, IIRC, the only way to have an application name under the icon on the android device that had white spaces in it, was via renaming the project file.
          It would not work via the ManifestInterface, nor via TARGET setting inside the pro file.

          Now the Application name inside the ManifestInterface can have the whitespaces, but the project file not.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          jsulmJ 1 Reply Last reply
          1
          • J.HilkJ J.Hilk

            So I run into that just recently.

            After 2 days of debugging and trying I found the error.

            For me it was white spaces My App Project.pro in the project file. Once I changed that to MyAppProject.pro the error went away.

            Strange that it used to work with whitespaces just fine. In fact, IIRC, the only way to have an application name under the icon on the android device that had white spaces in it, was via renaming the project file.
            It would not work via the ManifestInterface, nor via TARGET setting inside the pro file.

            Now the Application name inside the ManifestInterface can have the whitespaces, but the project file not.

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @J-Hilk White spaces are evil :-)

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • SeDiS SeDi has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved