简体   繁体   中英

Can't find Android build tool with ionic2 cordova

when I try to build an APK with

ionic cordova build android

Suddenly I faced this error

  * What went wrong: A problem occurred evaluating root project 'android'. 

No installed build tools found. Install the Android build tools version 19.1.0 or higher. 0

I'm sure that a have android build tool from android studio versions (2.1.1 - 22.0.0 - 23.0.0 ) and last version 26.0.1

output of cordova requirements

Requirements check results for android: Java JDK: installed 1.8.0 Android SDK: installed true Android target: not installed android: Command failed with exit code ENOENT Gradle: installed /Applications/Android Studio.app/Contents/gradle/gradle-3.2/bin/gradle Error: Some of requirements check failed

and this the uses sdk in AndroidMaifest.xml file

    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />

Installed platforms: android 6.2.3

Is your android sdk folder saved on your environment variables?

Try to add your root android SDK folder(something like C:\\android-sdk or C:\\Program Files (x86)\\Android\\android-sdk\\ ) to both ANDROID_HOME and ANDROID_SDK_ROOT environment variables.

Also add(change it to your current android sdk folder):
C:\\Program Files (x86)\\Android\\android-sdk\\tools
C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools

And maybe
C:\\Program Files (x86)\\Android\\android-sdk\\build-tools\\26.0.1

To your system's PATH variable

Then, download only the binary for gradle here

  1. Extract it to C:\\Gradle . Example: C:\\Gradle\\gradle-3.5
  2. Add C:\\Gradle\\gradle-CURRENTVERSION\\bin to the PATH variable.

After that, restart the computer or re-open any terminal you're running the command

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM