简体   繁体   中英

Ionic cordova build android fails - Due to some path error

I had created an ionic app which is based on daily expense management. The backend for my application is working on firebase. Now, I wanted to generate an APK for my app. I installed Cordova CLI to build android APK. I use a command like ionic cordova platform add android to add an android platform within my expense management demo application. Now I want to build an android app and for that, I'm using a command like ionic cordova build android but it gives me an error, and the error is like,

> cordova.cmd build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\radhika.thakkar\AppData\Local\Android\Sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

I tried lots of different paths to set for ANDROID_SDK_ROOT and ANDROID_HOME but all fail. So please help me out what should I do to build an android apk for my app.

Use capacitor instead of cordova. U need to build the gradle file in the android studio. Go to android studio in the tool section you can see build click that

You haven't set

ANDROID_SDK_ROOT=undefined (recommended setting) ionic cordova android build error (cordova.cmd build android exited with exit code 1) you have to set ANDROID_SDK_ROOT

ionic cordova android build error (cordova.cmd build android exited with exit code 1)

Setup Your root

  • Tools -> Android SDK Tools

  • Tools -> Android SDK Platform-tools

  • Tools -> Android SDK Build-tools

Where is android_sdk_root? and how do I set it.?

https://github.com/apache/cordova-android/issues/670

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