简体   繁体   中英

Build failed with CMD line --ionic cordova build android

I am facing issues and not able to find solution. Created an simple app with Ionic and cordova, Setup all enviroment variable { like JAVA_HOME, Android/sdk, Platform-tool, Gradle} and as usual ionic cordova build android command worked fine. I did somechanges like calling external data with HttpClient, And again when I am going to build with same command, facing below issues. Please help me to resolve. 在此处输入图片说明

cordova.cmd build android Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk (recommended setting) ANDROID_HOME=C:\\Users\\Lenovo\\AppData\\Local\\Android (DEPRECATED) Using Android SDK: C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk Subproject Path: CordovaLib Subproject Path: app Observed package id 'build-tools;29.0.3' in inconsistent location 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\build-tools\\29.0.3' (Expected 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\build-tools\\29.0.3') Observed package id 'emulator' in inconsistent location 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\emulator' (Expected 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\emulator') Observed package id 'extras;intel;Hardware_Accelerated_Execution_Manager' in inconsistent location 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\extras\\intel\\Hardware_Accelerated_Execution_Manager' (Expected 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\extras\\intel\\Hardware_Accelerated_Execution_Manager') Observed p ackage id 'patcher;v4' in inconsistent location 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\patcher\\v4' (Expected 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\patcher\\v4') Observed package id 'platform-tools' in inconsistent location 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\platform-tools' (Expected 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\platform-tools') Observed package id 'sources;android-29' in inconsistent location 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\sources\\android-29' (Expected 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\sources\\android-29') Observed package id 'system-images;android-R;google_apis_playstore;x86' in inconsistent location 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\system-images\\android-R\\google_apis_playstore\\x86' (Expected 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\system-images\\android-R\\google_apis_playstore\\x86') Observed package id 'tools' in inconsistent location 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\Sdk\\tools' (Expected 'C:\\Users\\Lenovo\\AppData\\Local\\Android\\tools ') Checking the license for package Android SDK Platform 29 in C:\\Users\\Lenovo\\AppData\\Local\\Android\\licenses Warning: License for package Android SDK Platform 29 not accepted.

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Failed to install the following Android SDK packages as some licences have not been accepted. platforms;android-29 Android SDK Platform 29 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

Using Android SDK: C:\\Users\\Lenovo\\AppData\\Local\\Android

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 17s Command failed with exit code 1: D:\\test\\project\\crud-app\\ionic app\\ionic-test\\riagitanjali\\platforms\\android\\gradlew cdvBuildDebug -b D:\\test\\project\\crud-app\\ionic app\\ionic-test\\riagitanjali\\platforms\\android\\build.gradle [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.

D:\\test\\project\\crud-app\\ionic app\\ionic-test\\riagitanjali>

You have to Accept Licenses for the Android SDK.

open CMD and Run command:

cd /d "%ANDROID_SDK_ROOT%/tools/bin"

then Run:

sdkmanager --licenses

and press Y on every step to accept license.

JAVA JDK 在上面的附图中被提及为 JAVA_HOME,即 Java\\jdk1.8.0_202

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