Ionic and Cordova build error: An error occurred while running Cordova build android --debug (Exit code 1):

Asked

Viewed 611 times

1

I’m trying to compile my application, but it gives the following message::

> cordova build android --debug
× Running command - failed!
[ERROR] An error occurred while running cordova build android --debug (exit code 1):


        Running command: "C:\Program Files\nodejs\node.exe"
        C:\apps\vovocooks-v10\hooks\after_prepare\010_add_platform_class.js C:\apps\vovocooks-v10
        add to body class: platform-android
        ANDROID_HOME=C:\Users\Ramos\AppData\Local\Android\sdk
        JAVA_HOME=C:\Program Files\java\jdk1.8.0_144
        Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
        :wrapper

        BUILD SUCCESSFUL

        Total time: 11.495 secs
        Subproject Path: CordovaLib
        null
        The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use
        Task.doLast(Action) instead.
                at build_455elprf89385ghd5v1ztjpv5.run(C:\apps\vovocooks-v10\platforms\android\build.gradle:139)
        org.xwalk:xwalk_core_library:23+
        The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
        Incremental java compilation is an incubating feature.
        The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please
        use TaskInputs.file(Object).skipWhenEmpty() instead.

        FAILURE: Build failed with an exception.

        * What went wrong:
        A problem occurred configuring root project 'android'.
        > Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
            > Could not find com.android.support:support-v13:26.0.2.
              Searched in the following locations:

        file:/C:/Users/Ramos/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v13/26.0.2/support-v13-26.0.2.pom

        file:/C:/Users/Ramos/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v13/26.0.2/support-v13-26.0.2.jar

        file:/C:/apps/vovocooks-v10/platforms/android/sdk-manager/com/android/support/support-v13/26.0.2/support-v13-26.0.2.jar
              Required by:
                  project :

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

        BUILD FAILED

        Total time: 14.626 secs
        Error: cmd: Command failed with exit code 1 Error output:
        FAILURE: Build failed with an exception.

        * What went wrong:
        A problem occurred configuring root project 'android'.
        > Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
            > Could not find com.android.support:support-v13:26.0.2.
              Searched in the following locations:

        file:/C:/Users/Ramos/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v13/26.0.2/support-v13-26.0.2.pom

        file:/C:/Users/Ramos/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v13/26.0.2/support-v13-26.0.2.jar

        file:/C:/apps/vovocooks-v10/platforms/android/sdk-manager/com/android/support/support-v13/26.0.2/support-v13-26.0.2.jar
              Required by:
                  project :

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I’ve already looked at the environment variables, and they seem to be all right, look:

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

Android and Java are up to date. What?

  • 2

    The methods Task.leftShift and TaskInputs.source were discontinued, use methods Task.doLast, TaskInputs.file. The method JavaCompile.setDependencyCacheDir() was removed from the version 4.0 gradle.

  • @Souza I didn’t understand. I searched my files of the methods mentioned, I couldn’t find anything. Could I explain it better? Thank you.

  • See in the file build.gradle, C:\apps\vovocooks-v10\platforms\android\build.gradle:139 line 139.

  • These methods refer to Gradle, your version of it is newer, so it is telling you that the methods were discontinued, so you will have to configure the file build.gradle of Gradle

1 answer

1


Could not find com.android.support:support-v13:26.0.2.

Starting with version 26 of the support libraries, check that the repositories section includes the address of the Google repository.

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

The Task.leftShift(Closure) method has been deprecated and is scheduled to be Removed in Gradle 5.0. Please use Task.doLast(Action) Instead.

The Taskinputs.source(Object) method has been deprecated and is scheduled to be Removed in Gradle 4.0. Please use Taskinputs.file(Object). skipWhenEmpty() Instead.

The Javacompile.setDependencyCacheDir() method has been deprecated and is scheduled to be Removed in Gradle 4.0.

The above lines found in registro de depuração ( Log ), is stating that :

  • The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. ( Free translation ).

  • The Taskinputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Use TaskInputs.file(Object).skipWhenEmpty() instead. ( Free translation ).

  • The Javacompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0. ( Free translation ).

  • It worked. Thank you @Wéllingthon

Browser other questions tagged

You are not signed in. Login or sign up in order to post.