构建错误 Ionic Android:构建失败,出现异常

Build error Ionic Android : Build failed with an exception

我尝试为 android 构建一个离子应用程序,但我遇到了这个错误:

What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.android.support:support-v4:+.
 Searched in the following locations:
     https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
     https://repo1.maven.org/maven2/com/android/support/support-v4/
 Required by:
     :android:unspecified

Android 支持库和 Android 支持存储库已安装。

感谢您的帮助

编辑:

我尝试更新 cordova 和 cordova-cli,但没有成功。

位置 https://repo1.maven.org/maven2/com/android/support/ 不再存在 (404)。所以maven配置似乎是问题所在。

我发现 a GitHub issue 与您遇到的相同问题,并且已通过 运行 更新 SDK(您已经这样做)并将 Android 平台读取到 Ionic 项目来解决:

# Update Android SDK
android list sdk
android update sdk --no-ui --filter extra

# Refresh Ionic Android configuration
ionic platform remove android
ionic platform add android

请在related question中查看我的回答。

简而言之:错误的来源可能是依赖于 com.android.support:support-v4 支持库的插件。

如果你使用cordova >= 5.0.0 更新到新的官方插件。