离子:不能从终端启动android模拟器

时间:2016-12-30 11:50:30

标签: cordova android-studio ionic-framework android-sdk-tools

我已经配置了离子android开发环境。我可以在Android studio 2.2.2中打开我的android项目并在模拟器中启动应用程序,一切正常。

但是,如果我去我的终端并去我的离子项目。并构建或模拟Android,如:

ionic build android
ionic emulate android

我收到错误:

Error: /Users/alex_fimm_dev/Desktop/Projects/ionic/myApp2/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'.
> Could not resolve all dependencies for configuration ':_debugApk'.
   > A problem occurred configuring project ':CordovaLib'.
      > Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
         > Could not find com.android.tools.build:gradle:2.2.2.
           Searched in the following locations:
               https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom
               https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.jar
           Required by:
               android:CordovaLib:unspecified

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

该项目再次在Android Studio上正常运行。

不确定我是否遗漏了某些步骤或事情,昨天开始使用离子。

以下是我的一些版本:

Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Android 7.1.1 API 25
Android SDK Tools 25.2.4
Android Platform-Tools 25.0.3
Cordova 6.4.0
node 7.3.0
npm  4.0.5
os x yosemite 10.10.2

1 个答案:

答案 0 :(得分:1)

删除平台/ android文件夹

ionic platform rm android

再次添加Android:

ionic platform add android
相关问题