簡體   English   中英

Ionic:無法構建android

[英]Ionic: Failed to build android

嘗試使用Ionic構建至android時遇到了大問題。 我最初嘗試正常的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.]

我在堆棧溢出和離子論壇上進行了一些搜尋,並安裝了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)

有什么建議嗎? 也許我需要卸載Android Studio或其他東西? 您可能會說,我對此很不好。 但這極大地阻礙了我正在從事的項目,因此如果有人可以提供幫助,那就太好了!

安裝Android開發環境開始

根據Android SDK的位置配置ANDROID_HOME環境變量。 另外,考慮將ANDROID_HOME / toolsANDROID_HOME / platform-tools添加到PATH。

對於Mac:

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

對於Windows:

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

對於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