QtCreator shows "could not resolve com.android.tools:gradle:3.0.1" for Qt on Android



  • I am able to build and run apps from Android studio, whereas if i build Qt App thru qtcreator it builds but after it show "could not resolve com.android.tools:gradle:3.0.1" and exit, but apps lib "libapp.so" has been created.

    it tries to download gradle-3.0.1.pom from google repo (pc is offline).
    How i can setup gradle for QtCreator to work correctly?


  • Moderators

    @pushp_arya said in QtCreator shows "could not resolve com.android.tools:gradle:3.0.1" for Qt on Android:

    How i can setup gradle for QtCreator to work correctly?

    Connect your PC to the Internet



  • i did but still same, i tried changing it to 3.0.0 and 4.4.1 but in error only no changes nothing else.

    I searched gradle-3.0.1.pom in android_sdk_path, and it found to be in <android_sdk_path>\gradle\m2repository\com\android\tools\build\gradle\3.0.1
    i don't know then why it still unable to find in QtCreator, in Android Studio Apps are building fine.


  • Moderators



  • When Building with Qt for android 5.10, instead of getting gradle from android install/setup, it tries to download old gradle version.
    for this i modified the "gradle-wrapper.properties", changed line "distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip"
    2nd in "build.gradle" file, i added google() in repositories and classpath to 'gradle:3.0.1' see below

    buildscript {
        repositories {
    		google()
    		jcenter()
        }
    
        dependencies {
    		classpath 'com.android.tools.build:gradle:3.0.1'
        }
    }
    
    allprojects {
        repositories {
    	        jcenter()
    		google()
        }
    }
    
    apply plugin: 'com.android.application'
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
    }
    
    android {
        /*******************************************************
         * The following variables:
         * - androidBuildToolsVersion,
         * - androidCompileSdkVersion
         * - qt5AndroidDir - holds the path to qt android files
         *                   needed to build any Qt application
         *                   on Android.
         *
         * are defined in gradle.properties file. This file is
         * updated by QtCreator and androiddeployqt tools.
         * Changing them manually might break the compilation!
         *******************************************************/
    
        compileSdkVersion androidCompileSdkVersion.toInteger()
    
        buildToolsVersion androidBuildToolsVersion
    
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
                aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
                res.srcDirs = [qt5AndroidDir + '/res', 'res']
                resources.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                assets.srcDirs = ['assets']
                jniLibs.srcDirs = ['libs']
           }
        }
    
        lintOptions {
            abortOnError false
        }
    }
    

    connected internet on virtual machine and download the required packages using build (gradle kept those packages in .gradle folder).
    whereas those packages existed in my Android SDK folder (<SDK_PATH>\tools\lib).

    another problem comes is deployment, it shows error

    "D:/Qt_Projects/build-untitled2-Android_for_x86_GCC_4_9_Qt_5_10_0_for_Android_x86-Debug/android-build//build/outputs/apk/android-build-debug.apk': No such file or directory
    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
    Installing to device failed!
    09:51:38: The process "C:/Qt/Qt5.10.0/5.10.0/android_x86/bin/androiddeployqt.exe" exited with code 16.
    09:51:38: Pulling files necessary for debugging.
    09:51:38: Package deploy: Running command "C:/Users/Pushpendra/AppData/Local/Android/sdk/platform-tools/adb.exe -s emulator-5554 pull /system/bin/app_process32 D:/Qt_Projects/build-untitled2-Android_for_x86_GCC_4_9_Qt_5_10_0_for_Android_x86-Debug/app_process".
    09:51:38: Package deploy: Running command "C:/Users/Pushpendra/AppData/Local/Android/sdk/platform-tools/adb.exe -s emulator-5554 pull /system/lib/libc.so D:/Qt_Projects/build-untitled2-Android_for_x86_GCC_4_9_Qt_5_10_0_for_Android_x86-Debug/libc.so".
    Error while building/deploying project untitled2 (kit: Android for x86 (GCC 4.9, Qt 5.10.0 for Android x86))
    When executing step "Deploy to Android device"
    09:51:38: Elapsed time: 00:59."
    

    whereas file was exited at the same location and i installed by dragging to emulator, which was working.
    My Setup was: Windows 10, Qt5.10.0 (android x86, android-7a), Android Studio 3.0.1, gradle-4.1, Android sdk from 19-27, mostly all basic libs installed, NDK 16b
    now I say that Qt's android plugin is still not mature and needs lot of work, and not many articles and help are available for the same.


  • Lifetime Qt Champion

    Hi,

    You are using a version of the NDK that is not recommended. That's well explained in the documentation @jsulm linked to.

    Before making a judgement call on the quality of a library, you should take into account all the factors like the habitude of Google to break compatibility with each new release of its NDK.

    Take a look at this thread on the Qt Android mailing list for example.



  • Dear @SGaist, i tried with both NDK, for your information and compiling has no problem.
    But is see it is problem with Deployment tool, as it is not finding the apk in path, whereas it existed. may be the path is wrong (i see '//' near build directory).

    D:/Qt_Projects/build-untitled2-Android_for_x86_GCC_4_9_Qt_5_10_0_for_Android_x86-Debug/android-build//build/outputs/apk/android-build-debug.apk': No such file or directory
    

    I agree that working on android is like hell even for their Java platform but what to do, everyone uses android or iOS because of their services (I was working on BB10 os once and it was nice as it's having Qt environment), Other OSs like sailfish, Ubuntu etc. not popular rarely someone use them.



  • @SGaist Unfortunately "NO" , ndk has nothing to do with this issue, I have similar project using only NDK 10e, When I use gradle 3.0.0 I get this issue .. if I switch back to gradle 2.3.3 (the default generated by Qt deployment) then issues do not appear, the issue are qml modules are not loaded:

    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
    


  • @pushp_arya said in QtCreator shows "could not resolve com.android.tools:gradle:3.0.1" for Qt on Android:

    droid is like hell even for their Java platform but what to do, everyone uses android

    I solved the issue (file not found ...) with gradle script, see this SO post ... unfortunately, QML warning unsolved and prevent my application from running on Qt 5.11.0


Log in to reply
 

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