Error with "Cordova run android"

Asked

Viewed 1,242 times

2

I’m getting an error entering command: "Cordova run android"

NOTE: Remembering that I have already set the path of sdk:

export PATH=$PATH:/home/giovanni/android/sdk/tools:/home/giovanni/android/sdk/platform-tools:/home/giovanni/android/sdk/build-tools:/home/giovanni/android/sdk/build-tools

ERROR:

giovanni@deathstar:~/Documentos/garconapp$ cordova run android

Error: Failed to find 'ANDROID_HOME' Environment variable. Try Setting Setting it Manually. Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to Valid SDK directory.

4 answers

1

To fix this error, just install android studio. And the same without taking charge of configuring these system variables.

0

Android Home must be the root folder (root folder) of the SDK.

If you’re using Windows, try:

set ANDROID_HOME=C:\\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Read more by clicking here

If the error persists, take a look here.

EDITION: For Linux, in your case, then:

export ANDROID_HOME="$HOME/android-sdk-linux"
  • also nice to download from: https://dl.google.com/android/repository/tools_r25.2.3-windows.zip and extract to C: Users CURRENT_USER Appdata Local Android sdk only so I could solve my problem

0

To make BUILD ANDROID

No cmd -> address of your project (D: xampp htdocs TESTE5) > Cordova build android

Below are the steps that should appear to build correctly

Checking Java JDK and Android SDK versions

ANDROID_SDK_ROOT=Undefined (Recommended Setting)

ANDROID_HOME=C: Users Marcos Appdata Local Android Sdk (DEPRECATED)

Welcome to Gradle 4.10.1!

Here are the Highlights of this release:

  • Incremental Java Compilation by default
  • Periodic Gradle caches Cleanup
  • Gradle Kotlin DSL 1.0-RC6
  • Nested included builds
  • SNAPSHOT plugin versions in the plugins {} block For more Details see https://docs.gradle.org/4.10.1/release-notes.html Starting a Gradle Daemon (subsequent builds will be Faster) BUILD SUCCESSFUL in 18s 1 actionable task: 1 executed Subproject Path: Cordovalib Subproject Path: app

• And on my computer:

• Android Studio installed and JAVA installed (C: Program Files Java jdk1.8.0_131)

• for environment variables: • ANDROID_HOME -> C: Android Users Sdk (address of your sdk) • JAVA_HOME -> C: Program Files Java jdk1.8.0_131 • No path: %ANDROID_HOME% tools, %ANDROID_HOME% Platform-tools, %JAVA_HOME% bin

0

Tries to edit the bashrc file as sudo:

sudo vim ~/. bashrc

At the end of the file, put:

export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/tools:/Platform-tools/:/build-tools/

In my case, the file with Android bin and libraries is in the user folder, so I use $HOME as the beginning of the path to the file, yours may be different, only change the first export to your ai.

After saving (:wq in vim), to apply the changes, execute:

source ~/. bashrc

Browser other questions tagged

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