Ionic 3.0.1:android 中的构建错误
Ionic 3.0.1: build error in android
最近我使用 command line tools.
从头开始安装 android sdk
我的 $PATH
变量在 ~/.bash_profile
中更新。
Ionic
和 Cordova
版本也更新了。
我使用 sdkmanager
:
安装了以下软件包
- 工具
- 平台;android-25
- 构建工具
- google 播放服务
- google 存储库
- 平台工具
构建 android 项目时,出现以下错误:
Error:
/Users/manugupta/Desktop/ionic-3/InvoicePhone/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-25' in: /Users/manugupta/Desktop/android_sdk
尝试:运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。
我已经试过了 但仍然出现同样的错误。
这是离子信息:
Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.10.2
Xcode version: Xcode 8.3.2 Build version 8E2002
这是 cordova requirements
的输出。除 Android 目标外的所有内容均已安装。
Android target: not installed Android SDK not found. Make sure that
it is installed. If it is not at the default location, set the
ANDROID_HOME environment variable.
但是,我已经使用sdkmanager "sources;android-25
安装了android-25。此外,还设置了ANDROID_HOME
。
这是我的 ~/.bash_profile
:
export ANDROID_HOME=/Users/manugupta/Desktop/android_sdk
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH=${PATH}:$ANDROID_HOME/bin/:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/25.0.2/:$ANDROID_HOME/tools:$ANDROID_HOME/sources
这是 echo $ANDROID_HOME
的输出:
/Users/manugupta/Desktop/android_sdk
这是cordova requirements
的输出:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Gradle: installed
Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 8.3.2
ios-deploy: installed 1.9.1
Error: Some of requirements check failed
使用 sdkmanager
时缺少一些依赖项。
因此,我下载了 Android Studio IDE 并再次安装了 android sdk
(通过 Android Studio 配置)。这解决了错误。
最近我使用 command line tools.
从头开始安装android sdk
我的 $PATH
变量在 ~/.bash_profile
中更新。
Ionic
和 Cordova
版本也更新了。
我使用 sdkmanager
:
- 工具
- 平台;android-25
- 构建工具
- google 播放服务
- google 存储库
- 平台工具
构建 android 项目时,出现以下错误:
Error: /Users/manugupta/Desktop/ionic-3/InvoicePhone/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-25' in: /Users/manugupta/Desktop/android_sdk
尝试:运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。
我已经试过了
这是离子信息:
Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.10.2
Xcode version: Xcode 8.3.2 Build version 8E2002
这是 cordova requirements
的输出。除 Android 目标外的所有内容均已安装。
Android target: not installed Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
但是,我已经使用sdkmanager "sources;android-25
安装了android-25。此外,还设置了ANDROID_HOME
。
这是我的 ~/.bash_profile
:
export ANDROID_HOME=/Users/manugupta/Desktop/android_sdk
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH=${PATH}:$ANDROID_HOME/bin/:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/25.0.2/:$ANDROID_HOME/tools:$ANDROID_HOME/sources
这是 echo $ANDROID_HOME
的输出:
/Users/manugupta/Desktop/android_sdk
这是cordova requirements
的输出:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Gradle: installed
Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 8.3.2
ios-deploy: installed 1.9.1
Error: Some of requirements check failed
使用 sdkmanager
时缺少一些依赖项。
因此,我下载了 Android Studio IDE 并再次安装了 android sdk
(通过 Android Studio 配置)。这解决了错误。