Incorrect APK directory



  • When building my project I get this error:

    Unable to open 'C:/QtProjects/build-MyApp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_3_for_Android_armv7-release/android-build//build/outputs/apk/android-build-release-unsigned.apk' as zip archive
    zipalign command failed.

    Of course it failed because the unsigned APK is not in this directory. There are 2 errors in the path. The first one, which probably wouldn't cause problems, is the duplicate slash between android-build//build. The more serious error in the path is the missing last subdirectory "release". So the correct path should be: C:/QtProjects/build-MyApp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_3_for_Android_armv7-release/android-build/build/outputs/apk/release/android-build-release-unsigned.apk

    Why is the directory wrong and how can I fix it?


  • Lifetime Qt Champion

    Hi,

    What version of Qt Creator are you using ?

    Did you modify any settings in it ?



  • I'm using the latest QtCreator (4.5) and tried it with both Qt 5.9 and 5.10. What I did was to update Android SDK (including NDK and Gradle) and changed the paths in settings to point to the current versions.

    The unsigned APK is built in the same directory as before but then QtCreator for some reason thinks it is somewhere else.

    Where does the path come from? I tried a fulltext search for the path in all files but I didn't find anything useful. Of course I tried to clean the build directory and cleaned all temporary files. But with no result.



  • I did some more research and testing and the problem was probably the updated gradle plugin version in build.gradle. Originally there was this:

    buildscript {
        repositories {
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.3'
        }
    }
    

    But Android Studio updated it to the latest version by changing the plugin version to 3.0.1. That should mean that Gradle 4.1+ will be used and QtCreator probably isn't compatible with it.



  • Somebody already filled this bug report.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.