none
[Taco][target Android] build error due to bad Gradle version RRS feed

  • Question

  • Hi,

    I'm trying to generate and deploy a new "Javascript Apache Cordova Mobile Apps"

    Environment :

    Microsoft Visual Studio Community 2017 RC

    Version 15.0.26020.0 D15REL
    Microsoft .NET Framework
    Version 4.6.01586

    Version installée : Community

    Visual Basic 2017 RC   00369-50000-00000-AA247
    Microsoft Visual Basic 2017 RC

    Visual C# 2017 RC   00369-50000-00000-AA247
    Microsoft Visual C# 2017 RC

    Visual C++ 2017 RC   00369-50000-00000-AA247
    Microsoft Visual C++ 2017 RC

    ASP.NET et Web Tools 2016   15.0.21206.0
    ASP.NET et Web Tools 2016

    Common Azure Tools   1.8
    Fournit des services courants utilisables par Microsoft Azure Mobile Services et Microsoft Azure Tools.

    Gestionnaire de package NuGet   4.0.0
    Gestionnaire de package NuGet dans Visual Studio. Pour plus d'informations sur NuGet, consultez la page http://docs.nuget.org/.

    Package Microsoft Visual Studio VC   1.0
    Package Microsoft Visual Studio VC

    Package Outils Application Insights pour Visual Studio   8.4.01118.2
    Outils Application Insights pour Visual Studio

    Service de langage JavaScript   2.0
    Service de langage JavaScript

    Système de projet JavaScript   2.0
    Système de projet JavaScript

    Système de projet UWP JavaScript   2.0
    Système de projet UWP JavaScript

    TypeScript   2.1.3.0
    Outils TypeScript pour Visual Studio

    Visual Studio Tools pour Apache Cordova   15.110.00.00
    Visual Studio Tools pour Apache Cordova

    Visual Studio Tools pour les applications Windows universelles   15.0.26009.00
    Visual Studio Tools pour les applications Windows universelles vous permet de créer une expérience d'application universelle unique que vous pouvez retrouver sur tous les appareils exécutant Windows 10 : téléphones, tablettes, PC, etc. Il inclut le Kit de développement logiciel (SDK) Microsoft Windows 10.

    - The generated project can be run successfully on simulator

    - The generated project can not be run on device

    1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.
    1>MSBUILD : cordova-build error : * Where:
    1>MSBUILD : cordova-build error : Build file 'C:\workspaceVS17\BlankCordovaApp2\BlankCordovaApp2\platforms\android\build.gradle' line: 20
    1>MSBUILD : cordova-build error : * What went wrong:
    1>MSBUILD : cordova-build error : A problem occurred evaluating root project 'android'.
    1>MSBUILD : cordova-build error : > Failed to apply plugin [id 'com.android.application']
    1>MSBUILD : cordova-build error :  > Minimum supported Gradle version is 2.14.1. Current version is 2.13. If using the gradle wrapper, try editing the distributionUrl in C:\workspaceVS17\BlankCordovaApp2\BlankCordovaApp2\gradle\wrapper\gradle-wrapper.properties to gradle-2.14.1-all.zip
    1>MSBUILD : cordova-build error : * Try:
    1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Command finished with error code 1: cmd /s /c "C:\workspaceVS17\BlankCordovaApp2\BlankCordovaApp2\platforms\android\gradlew.bat cdvBuildDebug -b C:\workspaceVS17\BlankCordovaApp2\BlankCordovaApp2\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
    1>MSBUILD : cordova-build error : Error: cmd: Command failed with exit code 1 Error output:
    1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.

    - If I show config.xml, I see I have only one CordovaToolset : Cordova 6.3.1

    cordova : 6.3.1

    noeud : 4.4.3

    npm : 2.15.0

    cordova-simulator 0.3.3

    cordova-android 5.2.1

    cordova-ios 4.2.0

    cordova-windows : 4.4.2

    My Android SDK is uptodate and configurated well

    I have AndroidStudio 2.2.3 installed and configurated well

    When I create new project in androidStudio, the gradle-wrapper.properties contains:

    distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

    The project builds and runs successfully

    The project generated in VS2017RC contains gradle-wrapper.properties (C:\workspaceVS17\BlankCordovaApp2\BlankCordovaApp2\platforms\android\gradle\wrapper) with

    distributionUrl=http\://services.gradle.org/distributions/gradle-2.13-all.zip

    How can I configure the gradle version used?

    Where the template used is store? (seems different than AndroidSdk template)

    BR,
    Sylvain

    Tuesday, January 24, 2017 9:29 AM

All replies

  • Hi,

    Could you please try open  "Platforms->Android->cordova->lib->builders->GradleBuilder.js" file, and find the following line:

    var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'http\\://services.gradle.org/distributions/gradle-2.13-all.zip';

    And change it to:

    var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-2.14.1-all.zip';

    Best Regards,

    Elvis Xia

    Wednesday, January 25, 2017 8:56 AM
  • Thanks Elvis !

    The change from 2.12 to 2.14.1 in GradleBuilder.js solved my issue.

    - I have tried to modify directly platforms\android\gradle\wrapper\gradle-wrapper.properties but it is regenerate at each compilation so I found out of platform folder.

    - I have modified "Platforms->Android->cordova->lib->builders->GradleBuilder.js" once, compiled end deployed on android device succesfully. So, I deleted platform folder thinking I had to change GradleBuilder.js after regenering but the fix stills working.

    Do you know where my change is saved?

    BR,

    Sylvain

    Wednesday, January 25, 2017 3:23 PM
  • i have crated a blank cordova android app on visula studio 2017. it works fine when i build for simulator in browser. But when i build for Device it throws following error


    BUILD FAILED

    Total time: 4 mins 50.36 secs

    1>MSBUILD : cordova-build error : * What went wrong:
    1>MSBUILD : cordova-build error : A problem occurred configuring root project 'android'.
    1>MSBUILD : cordova-build error : > Could not resolve all dependencies for configuration ':classpath'.
    1>MSBUILD : cordova-build error :  > Could not resolve com.android.tools.build:gradle:2.1.0.
    1>MSBUILD : cordova-build error :  Required by:
    1>MSBUILD : cordova-build error :  :android:unspecified
    1>MSBUILD : cordova-build error :  > Could not resolve com.android.tools.build:gradle:2.1.0.
    1>MSBUILD : cordova-build error :  > Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
    1>MSBUILD : cordova-build error :  > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
    1>MSBUILD : cordova-build error :  > Received fatal alert: protocol_version
    1>MSBUILD : cordova-build error :  > Could not resolve com.android.tools.build:gradle:2.1.0.
    1>MSBUILD : cordova-build error :  > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
    1>MSBUILD : cordova-build error :  > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
    1>MSBUILD : cordova-build error :  > Connection reset
    1>MSBUILD : cordova-build error : * Try:
    1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Command finished with error code 1: cmd /s /c ""c:\users\win8.1\documents\visual studio 2017\Projects\BlankCordovaApp2\platforms\android\gradlew.bat" cdvBuildDebug -b "c:\users\win8.1\documents\visual studio 2017\Projects\BlankCordovaApp2\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
    1>MSBUILD : cordova-build error : Error: cmd: Command failed with exit code 1 Error output:


    1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.
    1>MSBUILD : cordova-build error : * What went wrong:
    1>MSBUILD : cordova-build error : A problem occurred configuring root project 'android'.
    1>MSBUILD : cordova-build error : > Could not resolve all dependencies for configuration ':classpath'.
    1>MSBUILD : cordova-build error :  > Could not resolve com.android.tools.build:gradle:2.1.0.
    1>MSBUILD : cordova-build error :  Required by:
    1>MSBUILD : cordova-build error :  :android:unspecified
    1>MSBUILD : cordova-build error :  > Could not resolve com.android.tools.build:gradle:2.1.0.
    1>MSBUILD : cordova-build error :  > Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
    1>MSBUILD : cordova-build error :  > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
    1>MSBUILD : cordova-build error :  > Received fatal alert: protocol_version
    1>MSBUILD : cordova-build error :  > Could not resolve com.android.tools.build:gradle:2.1.0.
    1>MSBUILD : cordova-build error :  > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
    1>MSBUILD : cordova-build error :  > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
    1>MSBUILD : cordova-build error :  > Connection reset
    1>MSBUILD : cordova-build error : * Try:
    1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    1>MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M


    Sunday, November 4, 2018 6:11 AM