Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 2 Support (Qt 5) › Change Gradle Version of current project

Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #24346

    Patrik Dusek

    Hi all,

    I updated to the newest version of felgo and now I get a build error that my gradle version doesn’t fit.

    I added the androidx in gradle:

    implementation "androidx.appcompat:appcompat:1.2.0"

    And:

    apply plugin: 'com.android.application'

     

    But when I compile I get following error:

    > Failed to apply plugin [id 'com.android.application']
       > Minimum supported Gradle version is 4.10.1. Current version is 4.6. If using the gradle wrapper, try editing the distributionUrl in C:

    How can i update the gradle version, or is there something else I have to do?

    Thx,

    Patrik

     

     

    #24347

    Günther
    Felgo Team

    Hi Patrik,

    did you follow all steps described in the migration section of the release post:
    https://blog.felgo.com/release-3.9.0-overlays-tooltips-news-app-and-webassembly-browser-communication?hs_preview=HSNFSdlu-49421371305#androidx-migration

    The required changes include:
    – Update gradle version to 3.3.3
    classpath ‘com.android.tools.build:gradle:3.3.3’

    – Update dependencies to AndroidX
    // ADD THIS:
    implementation “androidx.appcompat:appcompat:1.2.0”

    // REMOVE THIS:
    // implementation “com.android.support:support-core-utils:28.0.0”
    // implementation “com.android.support:appcompat-v7:28.0.0″

    – Change file provider class name in AndroidManifest.xml:
    <!– UPDATE android:name HERE: –>
    <provider android:name=”androidx.core.content.FileProvider”
    android:authorities=”${applicationId}.fileprovider”
    android:exported=”false” android:grantUriPermissions=”true”>

    – When using Felgo Plugins, add compile option for Java 1.8
    android {
    // …
    compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
    }
    // …
    }

    #24348

    Patrik Dusek

    Hi Günther,

    so far I think I added all those points:

    buildscript {
        repositories {
            maven { url 'https://maven.google.com' }
            jcenter()
        }
    
        dependencies {
        classpath 'com.android.tools.build:gradle:3.3.3'
        }
    }
    
    allprojects {
        repositories {
            maven { url 'https://maven.google.com' }
            jcenter()
            maven { url 'https://install.felgo.com/maven/' }
        }
    }
    
    apply plugin: 'com.android.application'
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        compile project(':doccheck')
        implementation "androidx.appcompat:appcompat:1.2.0"
    
        implementation 'net.vplay.plugins:plugin-gcm:3.+'
        implementation 'net.vplay.plugins:plugin-onesignal:3.+'
    
    }
    
    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
    
        compileOptions {
          sourceCompatibility 1.8
          targetCompatibility 1.8
        }
    
        defaultConfig {
        multiDexEnabled true
          targetSdkVersion   androidCompileSdkVersion.toInteger()
          applicationId    = productIdentifier
          versionCode      = productVersionCode.toInteger()
          versionName      = productVersionName
    
          int qtVersionNr = project.hasProperty("qtVersionInt") ? qtVersionInt.toInteger() : 5132
          if (qtVersionNr < 5140) {
            resValue('array', 'load_local_libs', "")
          } else if (qtVersionNr >= 5140) {
            resValue('array', 'bundled_in_lib', "")
            resValue('array', 'bundled_in_assets', "")
          }
        }
    
        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
        }
    }
    
    

    And this line I added to my manifest:

            <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
    

    Thx,

    Patrik

    #24349

    Günther
    Felgo Team

    Regarding the manifest: There should already be an existing line for the configuration. It only requires an update of the android:name.

    A full snippet from e.g. Felgo playground project looks like this:
    <!– file provider needed for letting external apps (like camera) write to a file of the app –>
    <provider android:name=”androidx.core.content.FileProvider” android:authorities=”${applicationId}.fileprovider” android:exported=”false” android:grantUriPermissions=”true”>
    <meta-data android:name=”android.support.FILE_PROVIDER_PATHS” android:resource=”@xml/file_paths”/>
    </provider>

    You can also try to build & run the Felgo Playground project, to see whether the build works there and to check the default configuration.

    #24350

    Patrik Dusek

    Hi Günther,

    when I try to compile the playground for v7 release I get the same error. I checked my NDK: android-ndk-r20b. JDK: jdk1.8.0_112.

    Thats my whole manifest.

    <?xml version="1.0"?>
    <manifest package="com.thieme.infothek.caseappnvvhf" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
        <application android:hardwareAccelerated="true" android:name="net.vplay.helper.VPlayApplication" android:label="VHFPlus" android:icon="@drawable/icon" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
            <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="qt.android.java.MainActivity" android:label="@string/app_name" android:screenOrientation="sensor" android:launchMode="singleTop">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
                <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
                <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
                <meta-data android:name="android.app.repository" android:value="default"/>
                <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
                <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
                <!-- Deploy Qt libs as part of package -->
                <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
                <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
                <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
                <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
                <!-- Run with local libs -->
                <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
                <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
                <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
                <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
                <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
                <!--  Messages maps -->
                <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
                <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
                <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
                <!--  Messages maps -->
    
                <!-- Splash screen -->
                <!--
                <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
                -->
                <!-- Splash screen -->
    
                <!-- Background running -->
                <!-- Warning: changing this value to true may cause unexpected crashes if the
                              application still try to draw after
                              "applicationStateChanged(Qt::ApplicationSuspended)"
                              signal is sent! -->
                <meta-data android:name="android.app.background_running" android:value="false"/>
                <!-- Background running -->
    
                <!-- auto screen scale factor -->
                <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
                <!-- auto screen scale factor -->
            </activity>
            <activity android:name="com.doccheck.login.android.DocCheckLogin" android:configChanges="orientation|keyboard|keyboardHidden" android:label="@string/app_name">
                <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
            </activity>
    
            <!-- file provider needed for letting external apps (like camera) write to a file of the app -->
            <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
    
                <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"/>
            </provider>
    
        </application>
        <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
        <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
    
        <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
             Remove the comment if you do not require these default permissions. -->
        <!-- %%INSERT_PERMISSIONS -->
    
        <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
             Remove the comment if you do not require these default features. -->
        <!-- %%INSERT_FEATURES -->
    
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.SET_DEBUG_APP"/>
    </manifest>
    

     

    #24351

    Patrik Dusek

    Hi Günther,

    ok, I think I missunderstood that Androidx only works with the Android Multi Configuration and the old v7/v8 do not work.

    Is this correct?

    Thx,

    Patrik

    #24352

    Günther
    Felgo Team

    Hi,

    are you using the Felgo SDK from our installer with Qt 5.15.2, or did you install Felgo as an extension to a different Qt version via Qt Marketplace?

    #24353

    Günther
    Felgo Team
    #24354

    Patrik Dusek

    Hi Günther,

    I was using the previous, latest felgo version. I think it was 3.8.

    And in 3.8 the multi plattform wasn’t working.

    best,

    Patrik

     

    #24355

    Günther
    Felgo Team

    I see, yes you should use the multi-platform Android Kit to be compatible with all latest and future additions.

    What error do you have with it?
    Can you build with the multi-platform Kit using the default Felgo playground project?

Viewing 10 posts - 1 through 10 (of 10 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded