简体   繁体   中英

Ionic Cordova android build failed

I have an error while building the android part of my project.

1>MSBUILD : cordova-build error : Error: cmd: Command failed with exit code 1 Error output:
1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.
1>MSBUILD : cordova-build error : * What went wrong:
1>MSBUILD : cordova-build error : A problem occurred configuring root project 'android'.
1>MSBUILD : cordova-build error : > Failed to install the following SDK components:
1>MSBUILD : cordova-build error :  [Android SDK Platform 26]
1>MSBUILD : cordova-build error :  The SDK directory (C:\ProgramData\Microsoft\AndroidSDK\25) is not writeable,
1>MSBUILD : cordova-build error :  please update the directory permissions.

I have already installed the Android SDK Platform 26 but on a different location. (C:\\Program Files (x86)\\Android\\android-sdk)

But the cordova accessing a different directory (C:\\ProgramData\\Microsoft\\AndroidSDK\\25)

I'm thinking, how could I change the SDK path of the Ionic? Or how could I give permission to Ionic to write on a specific folder? Thanks!

PS: System Information

Visual Studio 2017 Version 15.5.7
Cordova-Android: 6.2.3
Cordova: 8.0.0
Gradle: 4.6

You can try setting the environment variable ANDROID_HOME to the right directory in your terminal

    set ANDROID_HOME=C:\<installation location>\
    set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

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