[SOLVED] Can't deploy & run application on Android device with API level 10

  • Hi.
    I want to build an application package that can be installed and run on any android version supported by Qt. AFAIK it is 2.3.3 (API 10) and higher for Qt 5.

    What I do:

    Create new Qt Gui Application in Qt Creator. Select kit: Android for arm (GCC 4.8, Qt 5.1.1)

    Add a couple of buttons to MainWindow form.

    Select "android-10" as Android target SDK in Projects / Run / Package configurations window.

    Press "Build Project" button. - Success.

    Press "Run" button. Got an error:

    12:02:08: Package deploy: Running command 'C:/opt/ant/bin/ant.bat clean debug'.
    [dex] Converting compiled files and external libraries into C:\jan\a2\android\bin\classes.dex...
    [dx] java.nio.BufferOverflowException
    [dx] at java.nio.Buffer.nextPutIndex(Buffer.java:519)
    [dx] at java.nio.HeapByteBuffer.putShort(HeapByteBuffer.java:315)
    [dx] at com.android.dex.Dex$Section.writeShort(Dex.java:818)
    [dx] at com.android.dex.Dex$Section.writeTypeList(Dex.java:870)
    [dx] at com.android.dx.merge.DexMerger$3.write(DexMerger.java:437)
    [dx] at com.android.dx.merge.DexMerger$3.write(DexMerger.java:423)
    [dx] at com.android.dx.merge.DexMerger$IdMerger.mergeUnsorted(DexMerger.java:317)
    [dx] at com.android.dx.merge.DexMerger.mergeTypeLists(DexMerger.java:423)
    [dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:163)
    [dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
    [dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
    [dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
    [dx] at com.android.dx.command.dexer.Main.run(Main.java:230)
    [dx] at com.android.dx.command.dexer.Main.main(Main.java:199)
    [dx] at com.android.dx.command.Main.main(Main.java:103)


    All this works fine if I select android-19 target SDK. Application deploys, runs, and works properly on emulator with API level 19.

    I also used adb tool to manually deploy the .apk (build for android-19) to the emulator with API level 10.
    Application was installed successfully. But when I started it I got black empty screen.

    I installed the same .apk to my HTC Desire (with CyanogenMod firmware - Android 2.3.7). When I run it I got an error message: "Your application encountered a fatal error and cannot continue."

    What I use:

    Android SDK with Android 2.3.3 (API 10) & Android 4.4 (API 19) SDK Platform installed

    Android NDK r9b

    Android for arm (GCC 4.8, Qt 5.1.1) Kit

    Qt Creator 2.8.1

    Windows 8.1


  • The "Android target SDK" is simply the SDK that is used for the build. You can use the most recent SDK for that. To set the minimum Android version, click the "Create AndroidManifest.xml" button and edit that (it defaults to 9).

  • BTW, when I encountered this issue, I filed this "bug":https://bugreports.qt-project.org/browse/QTBUG-35274.

  • I don't mind building with the latest SDK. I just want to be able to deploy & run apps on API 10 devices such as

    emulator with API level 10

    my HTC Desire smartphone

    How can I make Qt Creator to deploy my application to these devices?
    How can I make my application to work on these devices?

  • You already got the answer.
    Read three post above:

    “Create AndroidManifest.xml” button and edit that (it defaults to 9).

  • Sorry, I didn't get it.

    Where's that “Create AndroidManifest.xml” button? I can't find it.

    I tried to open android/AndroidManifest.xml file with Plain Text Editor and insert the following line:
    <uses-sdk android:minSdkVersion="10" />

    Is it the same thing?

    I set “android-19” as Android target SDK in Projects / Run / Package configurations window.

    When I press Run button it ignores running API 10 Emulator and tries to start one with API 19. Than reports an error: Cannot deploy: no devices or emulators found for your package.

    How can I make Qt Creator to deploy my app to API 10 emulator or my smartphone?

  • "Create AndroidManifest.xml" is in the same screen where you set the Android target SDK.
    Just a bit below.

    But if you cannot find it, then I suspect that it has been added to the Qt 5.2 beta.
    If so, just wait one more day... tomorrow will be release the Qt 5.2 release.

  • Yeah!
    It works with Qt 5.2 !

Log in to reply