简体   繁体   English

Ionic:无法构建android

[英]Ionic: Failed to build android

Having huge issues trying to build to android with Ionic. 尝试使用Ionic构建至android时遇到了大问题。 I tried initially the normal ionic build android , it failed with 我最初尝试正常的ionic build android ,但失败了

[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]

I did some hunting around stack overflow and ionic forums, and installed Java and Android Studio as a 'solution', it began to install lots of .jar files, and this happened: 我在堆栈溢出和离子论坛上进行了一些搜寻,并安装了Java和Android Studio作为“解决方案”,它开始安装大量.jar文件,这发生了:

 Download https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar


    Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.4/commons-codec-1.4.jar


    Download https://repo1.maven.org/maven2/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar


    Download https://repo1.maven.org/maven2/org/abego/treelayout/org.abego.treelayout.core/1.0.1/org.abego.treelayout.core-1.0.1.jar




    FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring root project 'android'.
    > failed to find target with hash string 'android-23' in: /Users/.../Library/Android/sdk

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


    BUILD FAILED

    Total time: 51.558 secs

    Error: /users/nick/documents/.../.../platforms/android/gradlew: Command failed with exit code 1 Error output:
    FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring root project 'android'.
    > failed to find target with hash string 'android-23' in: /Users/.../Library/Android/sdk

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Please install Android target: "android-23".

    Hint: Open the SDK manager by running: /Users/.../Library/Android/sdk/tools/android
    You will require:
    1. "SDK Platform" for android-23
    2. "Android SDK Platform-tools (latest)
    3. "Android SDK Build-tools" (latest)

Any advice? 有什么建议吗? Maybe I need to un-install Android Studio or something? 也许我需要卸载Android Studio或其他东西? I'm very bad at this, as you likely can tell. 您可能会说,我对此很不好。 But this is hugely holding back the project I'm working on, so will be amazing if someone could help! 但这极大地阻碍了我正在从事的项目,因此如果有人可以提供帮助,那就太好了!

Base from Installing the Android Development Environment 安装Android开发环境开始

Configure the ANDROID_HOME environment variable based on the location of the Android SDK. 根据Android SDK的位置配置ANDROID_HOME环境变量。 Additionally, consider adding ANDROID_HOME/tools , and ANDROID_HOME/platform-tools to your PATH. 另外,考虑将ANDROID_HOME / toolsANDROID_HOME / platform-tools添加到PATH。

For Mac : 对于Mac:

   export ANDROID_HOME=/<installation location>/android-sdk-macosx
  export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

For windows : 对于Windows:

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

For linux : 对于Linux:

export ANDROID_HOME=/<installation location>/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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