美文网首页工作生活
ionic编译时无法获取android.annotations包

ionic编译时无法获取android.annotations包

作者: 工程师INNOV | 来源:发表于2019-07-04 21:36 被阅读0次

ionic编译时运行命令

ionic cordova run android 

此时出现无法获取com.android.support:support-annotations包的问题。
具体原因是gradle编译时下载对应包时无法访问到dl.google.com

:app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.android.support:support-annotations:27.+.
  Required by:
      project :app
14 actionable tasks: 1 executed, 13 up-to-date
   > Could not resolve com.android.support:support-annotations:27.+.
      > Failed to list versions for com.android.support:support-annotations.
         > Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/maven-metadata.xml.
            > Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/maven-metadata.xml'.
               > 这是在主机名解析时 ? 常出现的暂时错误,它意味着本地服务器没有从权威服务器上收到响应 ? (dl.google.com)

解决办法是改为aliyun.com 的源,具体做法是在build.gradle文件中添加源

maven{ url 'https://maven.aliyun.com/repository/google' }

完整配置如下:


image.png

相关文章

网友评论

    本文标题:ionic编译时无法获取android.annotations包

    本文链接:https://www.haomeiwen.com/subject/daydhctx.html