Qt5.10 & Android Build: Gradle version 2.2 is required. Current version is 3.4.



  • In earlier Qt versions my Android build has been working correctly. After update to Qt 5.10 (Windows 10, NDK 16, SDK 24) I get the following build error:

    FAILURE: Build failed with an exception.
    
    * Where:
    Build file 'D:\Dev\QtBuilds\build-xxxApp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_0_for_Android_armv7-Release\android-build\build.gradle' line: 17
    
    * What went wrong:
    A problem occurred evaluating root project 'android-build'.
    > Failed to apply plugin [id 'com.android.application']
       > Gradle version 2.2 is required. Current version is 3.4. If using the gradle wrapper, try editing the distributionUrl in D:\Dev\QtBuilds\build-xxxApp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_0_for_Android_armv7-Release\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-2.2-all.zip
    

    I did a google search and tried some of the suggestions with modifing the gradle build/properties/distributionUrl files - but no success :-( Has anyone a suggestion here please?


  • Moderators

    @Rayman said in Qt5.10 & Android Build: Gradle version 2.2 is required. Current version is 3.4.:

    Failed to apply plugin [id 'com.android.application']
    Gradle version 2.2 is required. Current version is 3.4. If using the gradle wrapper, try editing the distributionUrl in D:\Dev\QtBuilds\build-xxxApp-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_0_for_Android_armv7-Release\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-2.2-all.zip

    The line is in my gradle-wrapper.properties as follows

    distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip
    

    You have the complete path in the quoted part of your post. Respectively you should also a gradle-wrapper.properties in with your source and not only in your build folder. Change it there.

    The above line works with Qt 5.9 and I would assume that you upgraded from an older version.

    Hope that helps.



  • I have the same line in the gradle-wrapper.properties refering to gradle-3.4-bin.zip as you, located in the project build folder as well as in the Qt folder: Qt\5.10.0\android_armv7\src\3rdparty\gradle\gradle\wrapper

    I also did a Clean Build as well as deleting the entire build folder. Before I used Qt 5.9 without problems.

    If I change gradle-3.4-bin.zip to 2.2 as the error message recommends, the version 2.2 gets downloaded during build, followed by a large number of other errors ..


  • Moderators

    @Rayman

    Did you check in creator under "Tools"->"Options"->"Devices", Tab "Android" that Andorid settings are ok?

    I have noted in my project SDK 26.0.2 and NDK 10.4.0 are set.

    You are listing SDK 24 and NDK 16.
    To step back in version numbers is not logical and also NDK version is a major step forward. In my trial I found that newest NDK was not correct.

    There might the problem, but I do not know.



  • @koahnig said in Qt5.10 & Android Build: Gradle version 2.2 is required. Current version is 3.4.:

    @Rayman

    Did you check in creator under "Tools"->"Options"->"Devices", Tab "Android" that Andorid settings are ok?

    Yes, all the settings are OK! I used NDK 13 before when the gradle error occured. So I did an update, but that didn't change anything.



  • @Rayman You should downgrade the NDK. All people who have build problems use NDK version higher than the recommended 10e.


  • Moderators

    @Rayman

    To add to @mvuori see also http://doc.qt.io/qt-5/androidgs.html



  • Thanks all so far! I downgraded NDK to 10e, deleted the build directories, removed the .gradle-folder in my user-directory, removed the project and its .pro.user file and imported the project again from scratch into Qt Creator 4.5.

    Upon Android build Gradle 3.4 has been automatically downloaded and the same error remains.

    Then I removed my QtCreator configuration folder so that all Qt settings got reseted and all Kits newly detected and configured.

    The same error remains :-(

    Edit: I changed my gradle-wrapper.properties files to distributionUrl Version 2.9 as suggested by this article and this works! I can successfully compile and deploy to Android systems (phone or emulator):

    https://discuss.gradle.org/t/gradle-thinks-2-10-is-less-than-2-2-when-resolving-plugins/13434

    From my point of view this is a gradle specific problem - and I wonder if I am are the only one using Qt 5.10 experiencing this behavior?!


  • Moderators

    @Rayman

    A bit strange that it works with a down-graded gradle.

    However, I suggest that you raise the issue also on https://groups.google.com/forum/#!forum/android-qt
    There is also BogDan who drove the support of android with Qt. Possibly there are more others too seeing similar issues.



  • Thank you! I will report this issue to the proposed google list!


Log in to reply
 

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