Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Signature problem (Android)



  • I have a signature problem when I try to generate a armebi-v7a application for Android:

    I get the following error message:

    BUILD SUCCESSFUL in 39s
    29 actionable tasks: 2 executed, 27 up-to-date
    Exception in thread "main" com.android.apksig.apk.ApkFormatException: Malformed ZIP Central Directory record #1 at file offset 20761847
    	at com.android.apksig.internal.apk.v1.V1SchemeVerifier.parseZipCentralDirectory(V1SchemeVerifier.java:1782)
    	at com.android.apksig.ApkVerifier.getAndroidManifestFromApk(ApkVerifier.java:429)
    	at com.android.apksig.ApkVerifier.verify(ApkVerifier.java:176)
    	at com.android.apksig.ApkVerifier.verify(ApkVerifier.java:125)
    	at com.android.apksigner.ApkSignerTool.verify(ApkSignerTool.java:466)
    	at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:112)
    Caused by: com.android.apksig.zip.ZipFormatException: Not a Central Directory record. Signature: 0xff9e45a7
    	at com.android.apksig.internal.zip.CentralDirectoryRecord.getRecord(CentralDirectoryRecord.java:143)
    	at com.android.apksig.internal.apk.v1.V1SchemeVerifier.parseZipCentralDirectory(V1SchemeVerifier.java:1780)
    	... 5 more
    Warning: QML import could not be resolved in any of the import paths: MyLib
    Warning: QML import could not be resolved in any of the import paths: MyLib
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Fusion.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Imagine.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Material.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Universal.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils
    apksigner command failed.
      -- Run with --verbose for more information.
    16:36:26: The process "E:\Qt\5.12.2\android_armv7\bin\androiddeployqt.exe" exited with code 15.
    Error while building/deploying project xxxxx  (kit: Android for armeabi-v7a (Clang Qt 5.12.2 for Android ARMv72))
    When executing step "Build Android APK"
    

    I use:
    Qt 5.12.2
    SDK 26.1.1
    NDK 19.2.5345600
    build-tools 28.0.3
    JDK: jdk1.8.0_181

    Everything was going until now. This is the first time I have received an error message of this type.

    Any ideas?

    Thanks!


  • Moderators

    @Francky033
    have you tried deleting the whole build folder yet? and build again



  • Yes ! without result...


  • Moderators

    @Francky033 I remember having something similar.

    That was due to special characters inside the app signing certificate a ü in my case.



  • @J.Hilk said in Signature problem (Android):

    app signing certificate

    I have found the source of the problem. In fact, apksigner is called before the end of the construction of the apk file, hence the error message about the structure of this file!

    In the build-tools directory of the Android SDK, it is therefore necessary to add a TIMEOUT in the apksigner.bat file



  • I am having the exact same problem:

    Exception in thread "main" com.android.apksig.apk.ApkFormatException: Malformed ZIP Central Directory record #1 at file offset 12039139
    	at com.android.apksig.internal.apk.v1.V1SchemeVerifier.parseZipCentralDirectory(V1SchemeVerifier.java:1761)
    	at com.android.apksig.ApkVerifier.getAndroidManifestFromApk(ApkVerifier.java:408)
    	at com.android.apksig.ApkVerifier.verify(ApkVerifier.java:175)
    	at com.android.apksig.ApkVerifier.verify(ApkVerifier.java:124)
    	at com.android.apksigner.ApkSignerTool.verify(ApkSignerTool.java:431)
    	at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:92)
    Caused by: com.android.apksig.zip.ZipFormatException: Not a Central Directory record. Signature: 0x3000
    	at com.android.apksig.internal.zip.CentralDirectoryRecord.getRecord(CentralDirectoryRecord.java:143)
    	at com.android.apksig.internal.apk.v1.V1SchemeVerifier.parseZipCentralDirectory(V1SchemeVerifier.java:1759)
    	... 5 more
    

    Since I am using a Mac OS, I don't have that apksigner.bat file.

    Any other idea how to fix this?



  • Hello,

    I have the same issue on MacOS. I tried to put a sleep 60 at the beginning of the apksigner script shell but it is not working...
    Does someone have a solution?

    I'm using Qt 5.13 for MAcOS with ANDROID NDK 18



  • I reinstalled the ANDROID SDK and it is working now...



  • This post is deleted!

Log in to reply